From 621946546b0fd71de3f0bc477dc4dbacabe219dd Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 9 May 2020 18:52:03 +0200 Subject: [PATCH] Ignite TNT by fire --- mods/ITEMS/mcl_fire/init.lua | 9 +++++++-- mods/ITEMS/mcl_tnt/init.lua | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_fire/init.lua b/mods/ITEMS/mcl_fire/init.lua index 381e4737..eabf3ed0 100644 --- a/mods/ITEMS/mcl_fire/init.lua +++ b/mods/ITEMS/mcl_fire/init.lua @@ -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 diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index a0d5dd01..90cb76d8 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -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