1
0
mirror of https://codeberg.org/tenplus1/ambience.git synced 2025-12-11 10:15:26 +01:00

add big splash effect when jumping in water

This commit is contained in:
tenplus1
2025-12-09 13:21:23 +00:00
parent f971ba562f
commit bc5d9367bb
4 changed files with 49 additions and 0 deletions

View File

@@ -86,3 +86,5 @@ Desert Simple.wav, Creative Commons 0 License, Proxima4, http://www.freesound.or
http://www.freesfx.co.uk/soundeffects/forests-jungles/
icecrack.ogg by ecfike, Creative Commons 0 license (https://freesound.org/people/ecfike/sounds/177212/)
big_splash.ogg by gubodup, Creative Commons 0 License (https://freesound.org/people/qubodup/sounds/442773/)

View File

@@ -3,3 +3,5 @@ ambience_music (Ambience music) bool true
# If enabled then ambience will take over sounds when moving in water
ambience_water_move (Ambience water movement) bool true
ambience_water_splash (Big splash when jumping in water) bool false

BIN
sounds/big_splash.ogg Normal file

Binary file not shown.

View File

@@ -11,6 +11,51 @@
local mod_def = core.get_modpath("default")
local mod_mcl = core.get_modpath("mcl_core")
-- Big Splash jumping in water
if core.settings:get_bool("ambience_water_splash") == true then
local in_water = {}
ambience.add_set("big_splash", {
frequency = 1000,
sounds = {
{name = "big_splash", gain = 0.3, length = 4, ephemeral = true}
},
sound_check = function(def)
local hdef = core.registered_nodes[def.head_node]
local fdef = core.registered_nodes[def.feet_node]
local name = def.player:get_player_name()
local vel
if core.has_feature("direct_velocity_on_players") then
vel = def.player:get_velocity()
else
vel = def.player:get_player_velocity()
end
if hdef and hdef.groups and hdef.groups.water
and fdef and fdef.groups and fdef.groups.water then
if not in_water[name] and vel.y < -0.15 then
in_water[name] = 2
return "big_splash"
end
else
if fdef and fdef.groups and fdef.groups.water then
in_water[name] = 1
else
in_water[name] = nil
end
end
end
})
end
-- Underwater sounds play when player head is submerged
ambience.add_set("underwater", {