forked from Mineclonia/Mineclonia
Fix nodes that should not burn up burning up
Nodes with the group “flammable = -1” (e.g. crafting tables) must be able to catch fire, but must not burn up. This patch adds checks for this group.
This commit is contained in:
parent
c12076e74d
commit
02fa2c9e07
|
@ -27,6 +27,10 @@ local spawn_smoke = function(pos)
|
||||||
}, "high")
|
}, "high")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function has_flammable(pos)
|
||||||
|
return minetest.find_node_near(pos, 1, {"group:flammable"})
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Items
|
-- Items
|
||||||
--
|
--
|
||||||
|
@ -104,7 +108,8 @@ minetest.register_node("mcl_fire:fire", {
|
||||||
drop = "",
|
drop = "",
|
||||||
sounds = {},
|
sounds = {},
|
||||||
on_timer= function(pos)
|
on_timer= function(pos)
|
||||||
if not minetest.find_node_near(pos, 1, {"group:flammable"}) then
|
local p=has_flammable(pos)
|
||||||
|
if not p or minetest.get_item_group(minetest.get_node(p).name, "flammable") == -1 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -339,10 +344,6 @@ minetest.register_abm({
|
||||||
-- [...]a fire that is not adjacent to any flammable block does not spread, even to another flammable block within the normal range.
|
-- [...]a fire that is not adjacent to any flammable block does not spread, even to another flammable block within the normal range.
|
||||||
-- https://minecraft.fandom.com/wiki/Fire#Spread
|
-- https://minecraft.fandom.com/wiki/Fire#Spread
|
||||||
|
|
||||||
local function has_flammable(pos)
|
|
||||||
return minetest.find_node_near(pos, 1, {"group:flammable"})
|
|
||||||
end
|
|
||||||
|
|
||||||
local function check_aircube(p1,p2)
|
local function check_aircube(p1,p2)
|
||||||
local nds=minetest.find_nodes_in_area(p1,p2,{"air"})
|
local nds=minetest.find_nodes_in_area(p1,p2,{"air"})
|
||||||
for k,v in pairs(nds) do
|
for k,v in pairs(nds) do
|
||||||
|
@ -415,15 +416,18 @@ else -- Fire enabled
|
||||||
chance = 18,
|
chance = 18,
|
||||||
catch_up = false,
|
catch_up = false,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
local p = minetest.find_node_near(pos, 1, {"group:flammable"})
|
local p = has_flammable(pos)
|
||||||
if not p then
|
if not p then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local flammable_node = minetest.get_node(p)
|
|
||||||
local def = minetest.registered_nodes[flammable_node.name]
|
local nn = minetest.get_node(p).name
|
||||||
if def.on_burn then
|
local def = minetest.registered_nodes[nn]
|
||||||
def.on_burn(p)
|
local fgroup = minetest.get_item_group(nn, "flammable")
|
||||||
else
|
|
||||||
|
if def and def._on_burn then
|
||||||
|
def._on_burn(p)
|
||||||
|
elseif fgroup ~= -1 then
|
||||||
minetest.swap_node(p, {name = "mcl_fire:fire"})
|
minetest.swap_node(p, {name = "mcl_fire:fire"})
|
||||||
fire_timer(p)
|
fire_timer(p)
|
||||||
minetest.check_for_falling(p)
|
minetest.check_for_falling(p)
|
||||||
|
|
Loading…
Reference in New Issue