This commit is contained in:
AFCMS 2021-03-27 20:23:51 +01:00
parent 30e50a64ef
commit 6a6b5970b3

@ -5,7 +5,7 @@ mcl_death_drop = {}
mcl_death_drop.registered_dropped_lists = {}
function mcl_death_drop.register_dropped_list(inv, listname, drop)
table.insert(mcl_death_drop.registered_dropped_player_lists, {inv=inv, listname=listname, drop=drop})
table.insert(mcl_death_drop.registered_dropped_lists, {inv=inv, listname=listname, drop=drop})
end
mcl_death_drop.register_dropped_list("PLAYER", "main", true)
@ -17,7 +17,7 @@ minetest.register_on_dieplayer(function(player)
local keep = minetest.settings:get_bool("mcl_keepInventory", false)
if keep == false then
-- Drop inventory, crafting grid and armor
local inv = player:get_inventory()
local playerinv = player:get_inventory()
local pos = player:get_pos()
local name, player_armor_inv, armor_armor_inv, pos = armor:get_valid_player(player, "[on_dieplayer]")
-- No item drop if in deep void
@ -25,6 +25,11 @@ minetest.register_on_dieplayer(function(player)
for l=1,#mcl_death_drop.registered_dropped_lists do
local inv = mcl_death_drop.registered_dropped_lists[l].inv
if inv == "PLAYER" then
inv = playerinv
elseif type(inv) == "function" then
inv = inv(player)
end
local listname = mcl_death_drop.registered_dropped_lists[l].listname
local drop = mcl_death_drop.registered_dropped_lists[l].drop
if inv ~= nil then