2017-06-09 10:42:21 +00:00
|
|
|
if minetest.setting_getbool("mcl_keep_inventory_on_death") == false then
|
2015-06-29 17:55:56 +00:00
|
|
|
minetest.register_on_dieplayer(function(player)
|
|
|
|
local inv = player:get_inventory()
|
|
|
|
local pos = player:getpos()
|
2017-03-01 22:26:46 +00:00
|
|
|
local lists = { "main", "craft", "armor" }
|
|
|
|
for l=1,#lists do
|
|
|
|
for i,stack in ipairs(inv:get_list(lists[l])) do
|
|
|
|
local x = math.random(0, 9)/3
|
|
|
|
local z = math.random(0, 9)/3
|
|
|
|
pos.x = pos.x + x
|
|
|
|
pos.z = pos.z + z
|
|
|
|
minetest.add_item(pos, stack)
|
|
|
|
stack:clear()
|
|
|
|
inv:set_stack(lists[l], i, stack)
|
|
|
|
pos.x = pos.x - x
|
|
|
|
pos.z = pos.z - z
|
|
|
|
end
|
2015-06-29 17:55:56 +00:00
|
|
|
end
|
|
|
|
end)
|
2017-06-09 10:42:21 +00:00
|
|
|
end
|