This commit is contained in:
Gundul 2024-07-29 20:25:26 +02:00
parent 88ecab34d9
commit 10b3b75ba7

View file

@ -16,6 +16,27 @@ local function is_owner(pos, name)
return false return false
end end
local drop = function(pos, itemstack)
local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count()))
if obj then
obj:set_velocity({
x = math.random(-10, 10) / 9,
y = 5,
z = math.random(-10, 10) / 9,
})
end
end
local dropContents = function(pos)
local inv = minetest.get_meta(pos):get_inventory()
for i = 1, inv:get_size("main") do
local stk = inv:get_stack("main", i)
drop(pos, stk)
end
minetest.remove_node(pos)
end
local bones_formspec = local bones_formspec =
"size[8,9]" .. "size[8,9]" ..
"list[current_name;main;0,0.3;8,4;]" .. "list[current_name;main;0,0.3;8,4;]" ..
@ -87,6 +108,10 @@ local bones_def = {
return return
end end
if not player:is_player() then
dropContents(pos)
end
if minetest.get_meta(pos):get_string("infotext") == "" then if minetest.get_meta(pos):get_string("infotext") == "" then
return return
end end
@ -171,17 +196,6 @@ local function may_replace(pos, player)
return node_definition.buildable_to return node_definition.buildable_to
end end
local drop = function(pos, itemstack)
local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count()))
if obj then
obj:set_velocity({
x = math.random(-10, 10) / 9,
y = 5,
z = math.random(-10, 10) / 9,
})
end
end
local player_inventory_lists = { "main", "craft" } local player_inventory_lists = { "main", "craft" }
bones.player_inventory_lists = player_inventory_lists bones.player_inventory_lists = player_inventory_lists