mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-07 06:06:10 -04:00
chests drop items inside when blown up
Chests will drop items inside when blown up
This commit is contained in:
parent
898715edf7
commit
750da16b4b
1 changed files with 15 additions and 1 deletions
|
@ -1473,7 +1473,21 @@ minetest.register_node("default:chest", {
|
|||
" takes " .. stack:get_name() ..
|
||||
" from chest at " .. minetest.pos_to_string(pos))
|
||||
end,
|
||||
on_blast = function() end,
|
||||
on_blast = function(pos)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
for i = 1, inv:get_size("main") do
|
||||
local m_stack = inv:get_stack("main", i)
|
||||
local obj = minetest.add_item(pos, m_stack)
|
||||
if obj then
|
||||
obj:setvelocity({
|
||||
x = math.random(-10, 10) / 9,
|
||||
y = 3,
|
||||
z = math.random(-10, 10) / 9
|
||||
})
|
||||
end
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("default:chest_locked", {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue