TNT: Add on_blast to all nodes with an inventory
Adds a minor helper function that allows efficient retrieval of several inventories from a node inventory. We use this helper to quickly retrieve the items in chests, vessel shelves, book shelves and furnaces, and return these with the nodes itself to the TNT caller. The TNT caller then performs the entity physics, and we don't need to do anything else. We disable TNT doing anything with bones. We expose a bug in the code that drops the items - metadata was lost entirely. This patch corrects that by properly copying the metadata and creating the drops list inclusive metadata.
This commit is contained in:
parent
03d6232f10
commit
a715f96818
4
init.lua
4
init.lua
@ -55,7 +55,9 @@ local function eject_drops(drops, pos, radius)
|
|||||||
item:get_count(),
|
item:get_count(),
|
||||||
item:get_stack_max()))
|
item:get_stack_max()))
|
||||||
rand_pos(pos, drop_pos, radius)
|
rand_pos(pos, drop_pos, radius)
|
||||||
local obj = minetest.add_item(drop_pos, item:get_name() .. " " .. take)
|
local dropitem = ItemStack(item)
|
||||||
|
dropitem:set_count(take)
|
||||||
|
local obj = minetest.add_item(drop_pos, dropitem)
|
||||||
if obj then
|
if obj then
|
||||||
obj:get_luaentity().collect = true
|
obj:get_luaentity().collect = true
|
||||||
obj:setacceleration({x = 0, y = -10, z = 0})
|
obj:setacceleration({x = 0, y = -10, z = 0})
|
||||||
|
Loading…
Reference in New Issue
Block a user