1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-28 12:46:02 +02:00

Add API to control respawn logic and behavior

This commit is contained in:
sfan5
2024-04-10 20:27:57 +02:00
parent d1ba7c3db3
commit c60d8e4da0
6 changed files with 115 additions and 66 deletions

View File

@ -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

View File

@ -1,3 +1,3 @@
name = beds
description = Minetest Game mod: beds
depends = default, wool
depends = default, wool, spawn