From c0bed6a690b2c7b39f66bbc6abfaafd8196e2912 Mon Sep 17 00:00:00 2001 From: oilboi <47129783+oilboi@users.noreply.github.com> Date: Mon, 4 May 2020 18:40:05 -0400 Subject: [PATCH] Fix annoying sound overlap in portals --- aether.lua | 7 ++++++- nether | 1 - nether.lua | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) delete mode 100644 nether diff --git a/aether.lua b/aether.lua index 60b5f61..88d4d98 100644 --- a/aether.lua +++ b/aether.lua @@ -46,7 +46,7 @@ minetest.register_globalstep(function(dtime) elseif hud_bg_id then --play heavenly sounds - if init_sound then + if init_sound and node and node.name == "aether:portal" then minetest.sound_fade(init_sound, -0.4, 0) init_sound = nil teleport_sound = minetest.sound_play("aether_teleport_complete",{gain=1}) @@ -59,6 +59,11 @@ minetest.register_globalstep(function(dtime) opacity = opacity - (dtime*100) minetest.localplayer:hud_change(hud_bg_id, "text", "aether_portal_gui.png^[opacity:"..opacity) + if init_sound then + minetest.sound_fade(init_sound, -0.4, 0) + init_sound = nil + end + if opacity <= 0 then minetest.localplayer:hud_remove(hud_bg_id) hud_bg_id = nil diff --git a/nether b/nether deleted file mode 100644 index 8b13789..0000000 --- a/nether +++ /dev/null @@ -1 +0,0 @@ - diff --git a/nether.lua b/nether.lua index 667582d..1d58e96 100644 --- a/nether.lua +++ b/nether.lua @@ -46,7 +46,7 @@ minetest.register_globalstep(function(dtime) elseif hud_bg_id then --play heavenly sounds - if init_sound then + if init_sound and node and node.name == "nether:portal" then minetest.sound_fade(init_sound, -0.4, 0) init_sound = nil teleport_sound = minetest.sound_play("portal_teleported",{gain=1}) @@ -59,6 +59,11 @@ minetest.register_globalstep(function(dtime) opacity = opacity - (dtime*100) minetest.localplayer:hud_change(hud_bg_id, "text", "nether_portal_gui.png^[opacity:"..opacity) + if init_sound then + minetest.sound_fade(init_sound, -0.4, 0) + init_sound = nil + end + if opacity <= 0 then minetest.localplayer:hud_remove(hud_bg_id) hud_bg_id = nil -- 2.44.0