add extra checks for spbattack

This commit is contained in:
Not 2022-08-23 17:10:10 +02:00
parent 27e596967c
commit bd5e3f24c6

View File

@ -12,7 +12,6 @@ local splits = {}
local PATCH = nil local PATCH = nil
local help = true local help = true
local EncoreInitial = nil local EncoreInitial = nil
local cv_teamchange
local scoreTable local scoreTable
@ -91,6 +90,10 @@ local ticsToTime
local allowJoin local allowJoin
--------------- ---------------
-- maploaded cvars
local cv_teamchange
local cv_spbatk
local cv_gui = CV_RegisterVar({ local cv_gui = CV_RegisterVar({
name = "lb_gui", name = "lb_gui",
defaultvalue = GUI_ON, defaultvalue = GUI_ON,
@ -805,6 +808,10 @@ addHook("MapLoad", function()
scrollAcc = 0 scrollAcc = 0
FlashTics = 0 FlashTics = 0
-- cvars
cv_teamchange = CV_FindVar("teamchange")
cv_spbatk = CV_FindVar("spbatk")
allowJoin(true) allowJoin(true)
--printTable(lb) --printTable(lb)
end end
@ -1382,7 +1389,9 @@ local function think()
-- Gamemode flags -- Gamemode flags
Flags = $ & !(F_SPBATK | F_SPBEXP | F_SPBBIG | F_SPBJUS) 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 Flags = $ | F_SPBATK
if server.SPBAexpert then if server.SPBAexpert then
Flags = $ | F_SPBEXP Flags = $ | F_SPBEXP
@ -1405,18 +1414,22 @@ local function think()
end end
end end
-- 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
if not (Flags & F_SPBATK) then end
else
hud.enable("freeplay") hud.enable("freeplay")
end end
end end
scoreTable = getScoreTable(gamemap, Flags) scoreTable = getScoreTable(gamemap, Flags)
if not cv_teamchange then
cv_teamchange = CV_FindVar("allowteamchange")
end
if p then if p then
-- Scroll controller -- Scroll controller
-- Spectators can't input buttons so let the gamer do it -- Spectators can't input buttons so let the gamer do it