forked from MineClone5/MineClone5
Ignite TNT by fire
This commit is contained in:
parent
ffcad31871
commit
621946546b
|
@ -132,14 +132,19 @@ 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)
|
||||
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
|
||||
-- Regular age increase
|
||||
if age + age_add <= 15 then
|
||||
node.param2 = age + age_add
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue