From 408183c6e7ba362005858e41d30123d33ac659a1 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Fri, 9 Feb 2018 21:34:43 +0100 Subject: [PATCH] [mobs] Handle on_blast correctly on chests & bones - Handle chests and bones returning a list of elements to be dropped after calling on_blast from fireball explosions. --- mods/mobs/api.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index ddd3b3e1..96f6a26b 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -2381,7 +2381,18 @@ function mobs:explosion(pos, radius, fire, smoke, sound) local on_blast = minetest.registered_nodes[n].on_blast if on_blast then - return on_blast(p) + local drops = on_blast(p) -- MFF(Lymkwi) : Chests and bones return their drops now + for _, name in ipairs(drops) do + local obj = minetest.add_item(p, ItemStack(name)) + if obj then + obj:setvelocity({ + x = math.random(-2, 2), + y = 7, + z = math.random(-2, 2) + }) + end + end + return end if not minetest.is_protected(p, "") --/MFF (Crabman|06/23/2015) re-added node protected in areas