1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 08:20:21 +01:00

Make shower tray turn off the showerhead above it when removed.

This commit is contained in:
Vanessa Ezekowitz 2015-04-28 14:40:15 -04:00
parent 1e3c27e984
commit 994849de7e

View File

@ -164,12 +164,24 @@ homedecor.register("shower_tray", {
groups = {cracky=2}, groups = {cracky=2},
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
on_destruct = function(pos) on_destruct = function(pos)
if id and s_handle then headpos = {x=pos.x, y=pos.y+2, z=pos.z}
local above_spawner_meta = minetest.get_meta(headpos)
local id = above_spawner_meta:get_int("active")
local s_handle = above_spawner_meta:get_int("sound")
if id ~= 0 then
minetest.delete_particlespawner(id) minetest.delete_particlespawner(id)
end
if s_handle then
minetest.after(0, function(s_handle) minetest.after(0, function(s_handle)
minetest.sound_stop(s_handle) minetest.sound_stop(s_handle)
end, s_handle) end, s_handle)
else return end end
above_spawner_meta:set_int("active", nil)
above_spawner_meta:set_int("sound", nil)
end end
}) })