1
0
Fork 0

Remove fire below air

This commit is contained in:
Wuzzy 2020-04-22 01:31:30 +02:00
parent e268370452
commit 0929ce4f20
1 changed files with 12 additions and 11 deletions

View File

@ -301,7 +301,7 @@ end
-- Extinguish all flames quickly with water and such -- Extinguish all flames quickly with water and such
minetest.register_abm({ minetest.register_abm({
label = "Extinguish flame", label = "Extinguish fire",
nodenames = {"mcl_fire:fire", "mcl_fire:eternal_fire"}, nodenames = {"mcl_fire:fire", "mcl_fire:eternal_fire"},
neighbors = {"group:puts_out_fire"}, neighbors = {"group:puts_out_fire"},
interval = 3, interval = 3,
@ -369,23 +369,24 @@ else -- Fire enabled
end, end,
}) })
-- Turn flammable nodes around fire into fire -- Turn flammable nodes into air
minetest.register_abm({ minetest.register_abm({
label = "Remove flammable nodes", label = "Remove flammable node below fire",
nodenames = {"group:fire"}, nodenames = {"group:fire"},
neighbors = {"group:flammable"}, neighbors = {"group:flammable"},
interval = 5, interval = 5,
chance = 18, chance = 18,
catch_up = false, catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local p = minetest.find_node_near(pos, 1, {"group:flammable"}) local p = {x=pos.x, y=pos.y-1, z=pos.z}
if p then local flammable_node = minetest.get_node(p)
local flammable_node = minetest.get_node(p) local def = minetest.registered_nodes[flammable_node.name]
local def = minetest.registered_nodes[flammable_node.name] if def.on_burn then
if def.on_burn then def.on_burn(p)
def.on_burn(p) else
else local g = minetest.get_item_group(flammable_node.name, "flammable")
minetest.set_node(p, {name="mcl_fire:fire"}) if g ~= -1 then
minetest.set_node(p, {name="air"})
minetest.check_for_falling(p) minetest.check_for_falling(p)
end end
end end