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 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
-- 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
if not (Flags & F_SPBATK) then
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