summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2024-08-30 14:09:27 -0500
committercheapie <no-email-for-you@example.com>2024-08-30 14:09:27 -0500
commitda5e807e3f8630dc0b3eaa6d34f57d3933aa532d (patch)
tree03a511f0107e08330b67b1e53d6502444745ddaa /init.lua
parentca8010bdaf830ab1dea310595aa1158a1f8fd340 (diff)
downloadhanddryer-da5e807e3f8630dc0b3eaa6d34f57d3933aa532d.tar
handdryer-da5e807e3f8630dc0b3eaa6d34f57d3933aa532d.tar.gz
handdryer-da5e807e3f8630dc0b3eaa6d34f57d3933aa532d.tar.bz2
handdryer-da5e807e3f8630dc0b3eaa6d34f57d3933aa532d.tar.xz
handdryer-da5e807e3f8630dc0b3eaa6d34f57d3933aa532d.zip
Fix automatic dryer sound getting stuck on if a running dryer is removed
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 8227780..a978f36 100644
--- a/init.lua
+++ b/init.lua
@@ -88,6 +88,17 @@ minetest.register_node("handdryer:xa5",{
"handdryer_metal.png",
"handdryer_xa5_front.png",
},
+ on_destruct = function(pos)
+ local posbelow = vector.add(pos,vector.new(0,-1,0))
+ local hash = minetest.hash_node_position(pos)
+ local handle = sounds[hash]
+ local meta = minetest.get_meta(pos)
+ if handle then minetest.sound_stop(handle) end
+ if meta:get_int("running") == 1 then
+ meta:set_int("running",0)
+ minetest.sound_play("handdryer_xa5_stop",{pos=pos,gain=0.75,max_hear_distance=20})
+ end
+ end,
})
minetest.register_abm({