mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-23 06:32:25 +01:00
Bones: Search for nearby 'air' for fallback bones placement
When a player dies on ladders or rope then a space can not be found at or above player, so this change looks around player for a space to place bones.
This commit is contained in:
parent
54235f3276
commit
0cbb516ae2
@ -180,15 +180,15 @@ minetest.register_on_dieplayer(function(player)
|
||||
local pos = vector.round(player:getpos())
|
||||
local player_name = player:get_player_name()
|
||||
|
||||
-- check if it's possible to place bones, if not go 1 higher
|
||||
if bones_mode == "bones" and not may_replace(pos, player) then
|
||||
pos.y = pos.y + 1
|
||||
end
|
||||
|
||||
-- still cannot place bones? change mode to 'drop'
|
||||
-- check if it's possible to place bones, if not find space near player
|
||||
if bones_mode == "bones" and not may_replace(pos, player) then
|
||||
local air = minetest.find_node_near(pos, 1, {"air"})
|
||||
if air and not minetest.is_protected(air, player_name) then
|
||||
pos = air
|
||||
else
|
||||
bones_mode = "drop"
|
||||
end
|
||||
end
|
||||
|
||||
if bones_mode == "drop" then
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user