mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 06:43:17 -04:00
Don't create bones if the player's inventory is empty
This commit is contained in:
parent
579c279be2
commit
7f3b8f28c5
1 changed files with 6 additions and 3 deletions
|
@ -82,6 +82,12 @@ minetest.register_on_dieplayer(function(player)
|
|||
return
|
||||
end
|
||||
|
||||
local player_inv = player:get_inventory()
|
||||
if player_inv:is_empty("main") and
|
||||
player_inv:is_empty("craft") then
|
||||
return
|
||||
end
|
||||
|
||||
local pos = player:getpos()
|
||||
pos.x = math.floor(pos.x+0.5)
|
||||
pos.y = math.floor(pos.y+0.5)
|
||||
|
@ -91,8 +97,6 @@ minetest.register_on_dieplayer(function(player)
|
|||
local nn = minetest.get_node(pos).name
|
||||
if minetest.registered_nodes[nn].can_dig and
|
||||
not minetest.registered_nodes[nn].can_dig(pos, player) then
|
||||
local player_inv = player:get_inventory()
|
||||
|
||||
for i=1,player_inv:get_size("main") do
|
||||
player_inv:set_stack("main", i, nil)
|
||||
end
|
||||
|
@ -107,7 +111,6 @@ minetest.register_on_dieplayer(function(player)
|
|||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local player_inv = player:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
|
||||
local empty_list = inv:get_list("main")
|
||||
|
|
Loading…
Add table
Reference in a new issue