forked from Mirrorlandia_minetest/tnt
TNT: Gunpowder (and tnt.burn) will trigger the on_ignite of nodes
The previous behaviour is kept as fallback for compatibility, for when the on_ignite is not defined in the node.
This commit is contained in:
parent
98c4fc4738
commit
1f1a1e81dd
10
init.lua
10
init.lua
@ -260,13 +260,15 @@ end
|
||||
|
||||
function tnt.burn(pos, nodename)
|
||||
local name = nodename or minetest.get_node(pos).name
|
||||
local group = minetest.get_item_group(name, "tnt")
|
||||
if group > 0 then
|
||||
local def = minetest.registered_nodes[name]
|
||||
if not def then
|
||||
return
|
||||
elseif def.on_ignite then
|
||||
def.on_ignite(pos)
|
||||
elseif minetest.get_item_group(name, "tnt") > 0 then
|
||||
minetest.sound_play("tnt_ignite", {pos = pos})
|
||||
minetest.set_node(pos, {name = name .. "_burning"})
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
elseif name == "tnt:gunpowder" then
|
||||
minetest.set_node(pos, {name = "tnt:gunpowder_burning"})
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user