This commit is contained in:
tenplus1 2016-04-15 19:36:28 +00:00
commit 61459fa78e

View file

@ -1463,16 +1463,33 @@ minetest.register_node("default:chest", {
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name() ..
" moves stuff in chest at " .. minetest.pos_to_string(pos)) " moves stuff in chest at " .. minetest.pos_to_string(pos))
end, end,
on_metadata_inventory_put = function(pos, listname, index, stack, player) on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name() ..
" moves " .. stack:get_name() .. " moves " .. stack:get_name() ..
" to chest at " .. minetest.pos_to_string(pos)) " to chest at " .. minetest.pos_to_string(pos))
end, end,
on_metadata_inventory_take = function(pos, listname, index, stack, player) on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name() ..
" takes " .. stack:get_name() .. " takes " .. stack:get_name() ..
" from chest at " .. minetest.pos_to_string(pos)) " from chest at " .. minetest.pos_to_string(pos))
end, end,
on_blast = function(pos)
minetest.after(0.1, function()
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)
end,
}) })
minetest.register_node("default:chest_locked", { minetest.register_node("default:chest_locked", {
@ -1511,26 +1528,26 @@ minetest.register_node("default:chest_locked", {
end end
return count return count
end, end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player) allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then if not has_locked_chest_privilege(meta, player) then
return 0 return 0
end end
return stack:get_count() return stack:get_count()
end, end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player) allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if not has_locked_chest_privilege(meta, player) then if not has_locked_chest_privilege(meta, player) then
return 0 return 0
end end
return stack:get_count() return stack:get_count()
end, end,
on_metadata_inventory_put = function(pos, listname, index, stack, player) on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name() ..
" moves " .. stack:get_name() .. " moves " .. stack:get_name() ..
" to locked chest at " .. minetest.pos_to_string(pos)) " to locked chest at " .. minetest.pos_to_string(pos))
end, end,
on_metadata_inventory_take = function(pos, listname, index, stack, player) on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() .. minetest.log("action", player:get_player_name() ..
" takes " .. stack:get_name() .. " takes " .. stack:get_name() ..
" from locked chest at " .. minetest.pos_to_string(pos)) " from locked chest at " .. minetest.pos_to_string(pos))