Fix sound stay active if destroy furnace/bonfire

This commit is contained in:
Wuzzy 2020-04-02 00:41:19 +02:00
parent 98a25222eb
commit 806fbf7c93
2 changed files with 14 additions and 2 deletions

View File

@ -120,6 +120,13 @@ minetest.register_node("bonfire:self_active", {
end end
return false return false
end, end,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)
if meta:get_int("sound_play") == 1 then
minetest.sound_stop(meta:get_int("sound_handle"))
meta:set_int("sound_play", 0)
end
end,
}) })
minetest.register_abm({ minetest.register_abm({
@ -220,7 +227,6 @@ minetest.register_abm({
meta:set_string("formspec", bonfire.formspec) meta:set_string("formspec", bonfire.formspec)
meta:set_int("active", 0) meta:set_int("active", 0)
meta:set_int("sound_play", 0) meta:set_int("sound_play", 0)
minetest.sound_stop(meta:get_int("sound_handle"))
return return
end end

View File

@ -151,6 +151,13 @@ minetest.register_node("furnace:self_active", {
end end
return true return true
end, end,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)
if meta:get_int("sound_play") == 1 then
minetest.sound_stop(meta:get_int("sound_handle"))
meta:set_int("sound_play", 0)
end
end,
}) })
minetest.register_abm({ minetest.register_abm({
@ -318,7 +325,6 @@ minetest.register_abm({
meta:set_string("formspec", furnace.formspec) meta:set_string("formspec", furnace.formspec)
meta:set_int("active", 0) meta:set_int("active", 0)
meta:set_int("sound_play", 0) meta:set_int("sound_play", 0)
minetest.sound_stop(meta:get_int("sound_handle"))
return return
end end