diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2017-03-01 20:28:28 +0000 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2017-03-01 20:28:28 +0000 |
commit | a6f3692c123205e0964af63bedac4687f0dc9862 (patch) | |
tree | df4a9dc50941b2a17ff0e2281cfb7a7bfe78c07b | |
parent | 66525a91a29b798c7ac707b3cf9c8d82a7b238b0 (diff) |
added sound when torch extinguished by water
-rw-r--r-- | water.lua | 32 |
1 files changed, 20 insertions, 12 deletions
@@ -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, |