mcl_death_drop: allow mods to overide default behaviour

This commit is contained in:
AFCMS 2021-07-02 18:07:29 +02:00
parent 19745cafbc
commit 3718bb6f80
1 changed files with 14 additions and 9 deletions

View File

@ -6,15 +6,8 @@ mcl_death_drop = {}
mcl_death_drop.registered_dropped_lists = {} mcl_death_drop.registered_dropped_lists = {}
function mcl_death_drop.register_dropped_list(inv, listname, drop) --This function can be overiden by mods
table.insert(mcl_death_drop.registered_dropped_lists, {inv = inv, listname = listname, drop = drop}) function mcl_death_drop.handler(player)
end
mcl_death_drop.register_dropped_list("PLAYER", "main", true)
mcl_death_drop.register_dropped_list("PLAYER", "craft", true)
mcl_death_drop.register_dropped_list("PLAYER", "armor", true)
minetest.register_on_dieplayer(function(player)
local keep = minetest.settings:get_bool("mcl_keepInventory", false) local keep = minetest.settings:get_bool("mcl_keepInventory", false)
if keep == false then if keep == false then
-- Drop inventory, crafting grid and armor -- Drop inventory, crafting grid and armor
@ -53,4 +46,16 @@ minetest.register_on_dieplayer(function(player)
end end
mcl_armor.update(player) mcl_armor.update(player)
end end
end
function mcl_death_drop.register_dropped_list(inv, listname, 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)
mcl_death_drop.register_dropped_list("PLAYER", "craft", true)
mcl_death_drop.register_dropped_list("PLAYER", "armor", true)
minetest.register_on_dieplayer(function(player)
mcl_death_drop.handler(player)
end) end)