Fix crash and tweak ctf_respawn_delay height

This commit is contained in:
LoneWolfHT 2020-12-09 08:47:43 -08:00
parent bf3fff7c53
commit 73e70fa29d

View file

@ -39,11 +39,11 @@ minetest.register_on_mods_loaded(function()
local pname = player:get_player_name()
if ctf_respawn_delay.players[pname] and ctf_respawn_delay.players[pname].timeleft == "waiting" then
ctf_respawn_delay.players[pname].timeleft = RESPAWN_DELAY
local pos = player:get_pos()
pos.y = 500
pos.y = ctf_map.map.h/2 + 10
player:set_pos(pos) -- Player will be stuck there because CTF 'air' is walkable
ctf_respawn_delay.players[pname].timeleft = RESPAWN_DELAY
minetest.after(RESPAWN_INTERVAL, respawnfunc, pname)
return true
@ -65,6 +65,12 @@ function respawnfunc(pname)
return
end
if type(ctf_respawn_delay.players[pname].timeleft) == "string" then
minetest.after(RESPAWN_INTERVAL, respawnfunc, pname)
return
end
ctf_respawn_delay.players[pname].timeleft = ctf_respawn_delay.players[pname].timeleft - 1
local timeleft = ctf_respawn_delay.players[pname].timeleft