Compare commits

..

3 Commits

Author SHA1 Message Date
518e9f7893 Only save/load files for the server 2022-08-24 19:25:53 +02:00
Not
a840a5fa83 revert maploaded cvars 2022-08-24 16:18:24 +02:00
Not
bd5e3f24c6 add extra checks for spbattack 2022-08-23 17:10:10 +02:00

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
---------------
-- cvars
local cv_teamchange
local cv_spbatk
local cv_gui = CV_RegisterVar({
name = "lb_gui",
defaultvalue = GUI_ON,
@ -254,6 +257,7 @@ local function stat_str(stat)
end
-- Read the leaderboard
if isserver then
local f = io.open(FILENAME, "r")
if f then
for l in f:lines() do
@ -309,6 +313,7 @@ if f then
else
print("Failed to open file: ", FILENAME)
end
end
function allowJoin(v)
if not cv_interrupt.value then
@ -1256,6 +1261,7 @@ local function saveTime(player)
StatTrack = true
end
if isserver then
local f = assert(io.open(FILENAME, "w"))
if f == nil then
print("Failed to open file for writing: " + FILENAME)
@ -1281,6 +1287,7 @@ local function saveTime(player)
f:close()
end
end
-- DEBUGGING
--local function saveLeaderboard(player, ...)
@ -1379,10 +1386,15 @@ local function think()
end
end
end
if not cv_spbatk then
cv_spbatk = CV_FindVar("spbatk")
end
-- 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,10 +1417,18 @@ 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)