added sound when torch extinguished by water

This commit is contained in:
TenPlus1 2017-03-01 20:28:28 +00:00
parent 66525a91a2
commit a6f3692c12

View File

@ -126,9 +126,11 @@ minetest.register_abm({
if ethereal.torchdrop == true then if ethereal.torchdrop == true then
local torch_drop = "default:torch" local torch_drop = "default:torch"
local drop_sound = "fire_extinguish_flame"
if minetest.get_modpath("real_torch") then if minetest.get_modpath("real_torch") then
torch_drop = "real_torch:torch" torch_drop = "real_torch:torch"
drop_sound = "real_torch_extinguish"
end end
minetest.register_abm({ 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},
{x = pos.x + 1, y = pos.y, z = pos.z}, {x = pos.x + 1, y = pos.y, z = pos.z},
{"group:water"}) {"group:water"})
if num == 0 then
num = num + #minetest.find_nodes_in_area( if num == 0 then
{x = pos.x, y = pos.y, z = pos.z - 1}, 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"}) {x = pos.x, y = pos.y, z = pos.z + 1},
end {"group:water"})
if num == 0 then end
num = num + #minetest.find_nodes_in_area(
{x = pos.x, y = pos.y + 1, z = pos.z}, if num == 0 then
{x = pos.x, y = pos.y + 1, z = pos.z}, num = num + #minetest.find_nodes_in_area(
{"group:water"}) {x = pos.x, y = pos.y + 1, z = pos.z},
end {x = pos.x, y = pos.y + 1, z = pos.z},
{"group:water"})
end
if num > 0 then if num > 0 then
minetest.set_node(pos, {name = "air"}) 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}) minetest.add_item(pos, {name = torch_drop})
end end
end, end,