forked from minetest/minetest_game
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.
This commit is contained in:
parent
3ecafbcfb4
commit
12d5ca2f48
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user