Add node timer back in so fires burn out

master
cora 2022-01-14 23:01:12 +01:00 committed by Nils Dagsson Moskopp
parent 8e8ccddb68
commit df4ea94dbc
No known key found for this signature in database
GPG Key ID: A3BC671C35191080
1 changed files with 9 additions and 6 deletions

View File

@ -85,10 +85,6 @@ local fire_death_messages = {
N("@1 died in a fire."),
}
local fire_timer = function(pos)
minetest.get_node_timer(pos):start(math.random(3, 7))
end
local spawn_fire = function(pos, age)
minetest.set_node(pos, {name="mcl_fire:fire", param2 = age})
minetest.check_single_for_falling({x=pos.x, y=pos.y+1, z=pos.z})
@ -126,6 +122,14 @@ minetest.register_node("mcl_fire:fire", {
end,
drop = "",
sounds = {},
on_timer= function(pos)
if not minetest.find_node_near(pos, 1, {"group:flammable"}) then
minetest.remove_node(pos)
return
end
-- Restart timer
return true
end,
-- Turn into eternal fire on special blocks, light Nether portal (if possible), start burning timer
on_construct = function(pos)
local bpos = {x=pos.x, y=pos.y-1, z=pos.z}
@ -139,8 +143,7 @@ minetest.register_node("mcl_fire:fire", {
if minetest.get_modpath("mcl_portals") then
mcl_portals.light_nether_portal(pos)
end
fire_timer(pos)
minetest.get_node_timer(pos):start(math.random(30, 60))
spawn_smoke(pos)
end,
on_destruct = function(pos)