forked from nalc/nalc_game
Beds: Only register respawn callbacks if respawn is enabled
This commit is contained in:
parent
9524ff67a3
commit
d89bb69a22
|
@ -173,19 +173,18 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- Callbacks
|
-- Callbacks
|
||||||
|
-- Only register respawn callback if respawn enabled
|
||||||
-- respawn player at bed if enabled and valid position is found
|
if enable_respawn then
|
||||||
minetest.register_on_respawnplayer(function(player)
|
-- respawn player at bed if enabled and valid position is found
|
||||||
if not enable_respawn then
|
minetest.register_on_respawnplayer(function(player)
|
||||||
return false
|
|
||||||
end
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local pos = beds.spawn[name] or nil
|
local pos = beds.spawn[name]
|
||||||
if pos then
|
if pos then
|
||||||
player:setpos(pos)
|
player:setpos(pos)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user