mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-07-05 06:00:43 -04:00
Add API to control respawn logic and behavior
This commit is contained in:
parent
d1ba7c3db3
commit
c60d8e4da0
6 changed files with 115 additions and 66 deletions
|
@ -244,10 +244,9 @@ end
|
|||
-- Callbacks
|
||||
-- Only register respawn callback if respawn enabled
|
||||
if enable_respawn then
|
||||
-- respawn player at bed if enabled and valid position is found
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local pos = beds.spawn[name]
|
||||
-- Respawn player at bed if valid position is found
|
||||
spawn.register_on_spawn(function(player, is_new)
|
||||
local pos = beds.spawn[player:get_player_name()]
|
||||
if pos then
|
||||
player:set_pos(pos)
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue