Add on_blast support

This commit is contained in:
Wuzzy 2019-12-09 21:06:08 +01:00
parent b71cf5e9c2
commit a1ab325920
1 changed files with 15 additions and 8 deletions

View File

@ -221,6 +221,12 @@ tnt.boom = function(pos, info)
-- TODO: Implement the real blast resistance algorithm
if def and n.name ~= "air" and n.name ~= "ignore" and (def._mcl_blast_resistance == nil or def._mcl_blast_resistance < 1000) then
activate_if_tnt(n.name, np, pos, 3)
-- Custom blast function defined by node.
-- Node removal and drops must be handled manually.
if def.on_blast then
def.on_blast(np, 1.0)
-- Default destruction handling: Remove nodes, drop items
else
minetest.remove_node(np)
core.check_for_falling(np)
if n.name ~= "mcl_tnt:tnt" and math.random() > 0.9 then
@ -237,6 +243,7 @@ tnt.boom = function(pos, info)
end
end
end
end
add_effects(pos, range, {})
end
end