Skip to content
Snippets Groups Projects
Commit 12d5ca2f authored by Auke Kok's avatar Auke Kok Committed by paramat
Browse files

Allow the on_blast API to pass an itemstack.

If the node is special and has an on_blast() handler, we need
to call it instead of getting node drops manually. However, we
do want to know if drops should be added for the special nodes,
so we modify the on_blast() handler code to allow the nodedef
handlers to pass back itemstacks. This could be used by e.g.
the doors mod to drop door items after a blast.

Since this API is documented in lua_api.txt, a separate PR will
be incoming to update the on_blast() documentation.
parent 3ecafbcf
No related branches found
No related tags found
No related merge requests found
......@@ -93,7 +93,12 @@ local function destroy(drops, pos, cid)
end
local def = cid_data[cid]
if def and def.on_blast then
def.on_blast(vector.new(pos), 1)
local node_drops = def.on_blast(vector.new(pos), 1)
if node_drops then
for _, item in ipairs(node_drops) do
add_drop(drops, item)
end
end
return
end
if def and def.flammable then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment