From: Auke Kok Date: Tue, 26 Jan 2016 06:27:15 +0000 (-0800) Subject: Allow the on_blast API to pass an itemstack. X-Git-Tag: 0.4.14~50 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=12d5ca2f48694c990658d401e5f68d281f260aee;p=oweals%2Fminetest_game.git 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. --- diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua index 981cc9ee..6b16ab7e 100644 --- a/mods/tnt/init.lua +++ b/mods/tnt/init.lua @@ -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