From bd5e3f24c672aba6b4fc26bdd284655d6654de07 Mon Sep 17 00:00:00 2001 From: Not Date: Tue, 23 Aug 2022 17:10:10 +0200 Subject: [PATCH] add extra checks for spbattack --- leaderboard.lua | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/leaderboard.lua b/leaderboard.lua index 5fea551..99964f7 100644 --- a/leaderboard.lua +++ b/leaderboard.lua @@ -12,7 +12,6 @@ local splits = {} local PATCH = nil local help = true local EncoreInitial = nil -local cv_teamchange local scoreTable @@ -91,6 +90,10 @@ local ticsToTime local allowJoin --------------- +-- maploaded cvars +local cv_teamchange +local cv_spbatk + local cv_gui = CV_RegisterVar({ name = "lb_gui", defaultvalue = GUI_ON, @@ -805,6 +808,10 @@ addHook("MapLoad", function() scrollAcc = 0 FlashTics = 0 + -- cvars + cv_teamchange = CV_FindVar("teamchange") + cv_spbatk = CV_FindVar("spbatk") + allowJoin(true) --printTable(lb) end @@ -1382,7 +1389,9 @@ local function think() -- Gamemode flags Flags = $ & !(F_SPBATK | F_SPBEXP | F_SPBBIG | F_SPBJUS) - if leveltime > START_TIME - (3 * TICRATE) / 2 and server.SPBArunning then + if server.SPBArunning + and cv_spbatk.value + and leveltime > START_TIME - (3 * TICRATE) / 2 then Flags = $ | F_SPBATK if server.SPBAexpert then Flags = $ | F_SPBEXP @@ -1405,18 +1414,22 @@ local function think() end end - end - if not (Flags & F_SPBATK) then + -- make sure the spb actually spawned + if leveltime == START_TIME - 1 then + if not (server.SPBAbomb and server.SPBAbomb.valid) then + -- it didn't spawn, clear spb flags + Flags = $ & !(F_SPBATK | F_SPBEXP | F_SPBBIG | F_SPBJUS) + end + end + + else hud.enable("freeplay") end + end scoreTable = getScoreTable(gamemap, Flags) - if not cv_teamchange then - cv_teamchange = CV_FindVar("allowteamchange") - end - if p then -- Scroll controller -- Spectators can't input buttons so let the gamer do it