Destroy fire by flooding

This commit is contained in:
Wuzzy 2017-08-21 16:37:21 +02:00
parent 1189b8d299
commit 16c1181a47

View File

@ -36,6 +36,12 @@ minetest.register_node("mcl_fire:fire", {
sunlight_propagates = true,
damage_per_second = 1,
groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston=1},
floodable = true,
on_flood = function(pos, oldnode, newnode)
if minetest.get_item_group(newnode.name, "water") ~= 0 then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
end
end,
on_timer = function(pos)
local airs = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"air"})
if #airs == 0 then
@ -100,6 +106,12 @@ minetest.register_node("mcl_fire:eternal_fire", {
sunlight_propagates = true,
damage_per_second = 1,
groups = {fire = 1, dig_immediate = 3, not_in_creative_inventory = 1, dig_by_piston = 1},
floodable = true,
on_flood = function(pos, oldnode, newnode)
if minetest.get_item_group(newnode.name, "water") ~= 0 then
minetest.sound_play("fire_extinguish_flame", {pos = pos, gain = 0.25, max_hear_distance = 16})
end
end,
on_timer = function(pos)
local airs = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"air"})
while #airs > 0 do