1
0
Fork 0

Ignite TNT by fire

This commit is contained in:
Wuzzy 2020-05-09 18:52:03 +02:00
parent ffcad31871
commit 621946546b
2 changed files with 12 additions and 3 deletions

View File

@ -132,11 +132,16 @@ minetest.register_node("mcl_fire:fire", {
end
end
else
-- Replace flammable node with fire
-- Burn flammable block
local nodes = 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}, {"group:flammable"})
if #nodes > 0 then
local r = math.random(1, #nodes)
spawn_fire(nodes[r], age_next)
local ndef = minetest.registered_nodes[minetest.get_node(nodes[r]).name]
if ndef and ndef._on_burn then
ndef._on_burn(nodes[r])
else
spawn_fire(nodes[r], age_next)
end
end
end
end

View File

@ -67,7 +67,7 @@ minetest.register_node("mcl_tnt:tnt", {
_tt_help = S("Ignited by tools, explosions, fire, lava, redstone power").."\n"..S("Explosion radius: @1", tostring(TNT_RANGE)),
_doc_items_longdesc = longdesc,
_doc_items_usagehelp = S("Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds."),
groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 },
groups = { dig_immediate = 3, tnt = 1, enderman_takable=1, flammable=-1 },
mesecons = tnt_mesecons,
on_blast = function(pos)
local e = spawn_tnt(pos, "mcl_tnt:tnt")
@ -78,6 +78,10 @@ minetest.register_node("mcl_tnt:tnt", {
tnt.ignite(pointed_thing.under)
return true
end,
_on_burn = function(pos)
tnt.ignite(pos)
return true
end,
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
-- Place and ignite TNT
if minetest.registered_nodes[dropnode.name].buildable_to then