From 73e70fa29d26e9d3886718f605ad6bad670f7578 Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Wed, 9 Dec 2020 08:47:43 -0800 Subject: [PATCH] Fix crash and tweak ctf_respawn_delay height --- mods/ctf/ctf_respawn_delay/init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mods/ctf/ctf_respawn_delay/init.lua b/mods/ctf/ctf_respawn_delay/init.lua index 1df6991..1ea2761 100644 --- a/mods/ctf/ctf_respawn_delay/init.lua +++ b/mods/ctf/ctf_respawn_delay/init.lua @@ -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