mirror of
https://github.com/minetest/minetest_game.git
synced 2025-01-08 22:50:16 +01:00
This commit is contained in:
parent
da3c36ded8
commit
25ff385294
@ -212,13 +212,23 @@ bones.register_collect_items(function(player)
|
|||||||
local items = {}
|
local items = {}
|
||||||
local player_inv = player:get_inventory()
|
local player_inv = player:get_inventory()
|
||||||
for _, list_name in ipairs(bones.player_inventory_lists) do
|
for _, list_name in ipairs(bones.player_inventory_lists) do
|
||||||
table.insert_all(items, player_inv:get_list(list_name) or {})
|
local inv_list=player_inv:get_list(list_name) or {}
|
||||||
|
for _, inv_slot in ipairs(inv_list) do
|
||||||
|
if inv_slot:get_count() > 0 then
|
||||||
|
table.insert(items, inv_slot)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
player_inv:set_list(list_name, {})
|
player_inv:set_list(list_name, {})
|
||||||
end
|
end
|
||||||
return items
|
return items
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function collect_items(player)
|
local function collect_items(player, player_name)
|
||||||
|
if minetest.is_creative_enabled(player_name) then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
|
||||||
local items = {}
|
local items = {}
|
||||||
for _, cb in ipairs(collect_items_callbacks) do
|
for _, cb in ipairs(collect_items_callbacks) do
|
||||||
table.insert_all(items, cb(player))
|
table.insert_all(items, cb(player))
|
||||||
@ -289,9 +299,9 @@ minetest.register_on_dieplayer(function(player)
|
|||||||
local bones_position_message = minetest.settings:get_bool("bones_position_message") == true
|
local bones_position_message = minetest.settings:get_bool("bones_position_message") == true
|
||||||
local pos_string = minetest.pos_to_string(player:get_pos())
|
local pos_string = minetest.pos_to_string(player:get_pos())
|
||||||
|
|
||||||
local items = collect_items(player)
|
local items = collect_items(player, player_name)
|
||||||
|
|
||||||
if bones_mode == "keep" or minetest.is_creative_enabled(player_name) or #items == 0 then
|
if bones_mode == "keep" or #items == 0 then
|
||||||
minetest.log("action", player_name .. " dies at " .. pos_string ..
|
minetest.log("action", player_name .. " dies at " .. pos_string ..
|
||||||
". No bones placed")
|
". No bones placed")
|
||||||
if bones_position_message then
|
if bones_position_message then
|
||||||
|
Loading…
Reference in New Issue
Block a user