TNT: start fire nodetimers for created fire nodes.
Without this patch, any fire created(placed) by tnt explosions will remain forever on the map.
This commit is contained in:
parent
b87ef5ccde
commit
7b90044574
@ -83,7 +83,10 @@ local function add_drop(drops, item)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_protection, ignore_on_blast)
|
local basic_flame_on_construct -- cached value
|
||||||
|
local function destroy(drops, npos, cid, c_air, c_fire,
|
||||||
|
on_blast_queue, on_construct_queue,
|
||||||
|
ignore_protection, ignore_on_blast)
|
||||||
if not ignore_protection and minetest.is_protected(npos, "") then
|
if not ignore_protection and minetest.is_protected(npos, "") then
|
||||||
return cid
|
return cid
|
||||||
end
|
end
|
||||||
@ -93,9 +96,16 @@ local function destroy(drops, npos, cid, c_air, c_fire, on_blast_queue, ignore_p
|
|||||||
if not def then
|
if not def then
|
||||||
return c_air
|
return c_air
|
||||||
elseif not ignore_on_blast and def.on_blast then
|
elseif not ignore_on_blast and def.on_blast then
|
||||||
on_blast_queue[#on_blast_queue + 1] = {pos = vector.new(npos), on_blast = def.on_blast}
|
on_blast_queue[#on_blast_queue + 1] = {
|
||||||
|
pos = vector.new(npos),
|
||||||
|
on_blast = def.on_blast
|
||||||
|
}
|
||||||
return cid
|
return cid
|
||||||
elseif def.flammable then
|
elseif def.flammable then
|
||||||
|
on_construct_queue[#on_construct_queue + 1] = {
|
||||||
|
fn = basic_flame_on_construct,
|
||||||
|
pos = vector.new(npos)
|
||||||
|
}
|
||||||
return c_fire
|
return c_fire
|
||||||
else
|
else
|
||||||
local node_drops = minetest.get_node_drops(def.name, "")
|
local node_drops = minetest.get_node_drops(def.name, "")
|
||||||
@ -306,6 +316,8 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
|||||||
|
|
||||||
local drops = {}
|
local drops = {}
|
||||||
local on_blast_queue = {}
|
local on_blast_queue = {}
|
||||||
|
local on_construct_queue = {}
|
||||||
|
basic_flame_on_construct = minetest.registered_nodes["fire:basic_flame"].on_construct
|
||||||
|
|
||||||
local c_fire = minetest.get_content_id("fire:basic_flame")
|
local c_fire = minetest.get_content_id("fire:basic_flame")
|
||||||
for z = -radius, radius do
|
for z = -radius, radius do
|
||||||
@ -318,8 +330,8 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
|||||||
local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z}
|
local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z}
|
||||||
if cid ~= c_air then
|
if cid ~= c_air then
|
||||||
data[vi] = destroy(drops, p, cid, c_air, c_fire,
|
data[vi] = destroy(drops, p, cid, c_air, c_fire,
|
||||||
on_blast_queue, ignore_protection,
|
on_blast_queue, on_construct_queue,
|
||||||
ignore_on_blast)
|
ignore_protection, ignore_on_blast)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vi = vi + 1
|
vi = vi + 1
|
||||||
@ -357,6 +369,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for _, queued_data in pairs(on_construct_queue) do
|
||||||
|
queued_data.fn(queued_data.pos)
|
||||||
|
end
|
||||||
|
|
||||||
return drops, radius
|
return drops, radius
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user