From a6f3692c123205e0964af63bedac4687f0dc9862 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Wed, 1 Mar 2017 20:28:28 +0000 Subject: added sound when torch extinguished by water --- water.lua | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/water.lua b/water.lua index 6a994e8..a698ebb 100644 --- a/water.lua +++ b/water.lua @@ -126,9 +126,11 @@ minetest.register_abm({ if ethereal.torchdrop == true then local torch_drop = "default:torch" +local drop_sound = "fire_extinguish_flame" if minetest.get_modpath("real_torch") then torch_drop = "real_torch:torch" + drop_sound = "real_torch_extinguish" end minetest.register_abm({ @@ -145,22 +147,28 @@ minetest.register_abm({ {x = pos.x - 1, y = pos.y, z = pos.z}, {x = pos.x + 1, y = pos.y, z = pos.z}, {"group:water"}) -if num == 0 then - num = num + #minetest.find_nodes_in_area( - {x = pos.x, y = pos.y, z = pos.z - 1}, - {x = pos.x, y = pos.y, z = pos.z + 1}, - {"group:water"}) -end -if num == 0 then - num = num + #minetest.find_nodes_in_area( - {x = pos.x, y = pos.y + 1, z = pos.z}, - {x = pos.x, y = pos.y + 1, z = pos.z}, - {"group:water"}) -end + + if num == 0 then + num = num + #minetest.find_nodes_in_area( + {x = pos.x, y = pos.y, z = pos.z - 1}, + {x = pos.x, y = pos.y, z = pos.z + 1}, + {"group:water"}) + end + + if num == 0 then + num = num + #minetest.find_nodes_in_area( + {x = pos.x, y = pos.y + 1, z = pos.z}, + {x = pos.x, y = pos.y + 1, z = pos.z}, + {"group:water"}) + end + if num > 0 then minetest.set_node(pos, {name = "air"}) + minetest.sound_play({name = drop_sound, gain = 0.2}, + {pos = pos, max_hear_distance = 10}) + minetest.add_item(pos, {name = torch_drop}) end end, -- cgit v1.2.3