only look for scoreTable once

This commit is contained in:
Lonsfor 2022-04-30 23:11:52 +02:00
parent 14f8769d93
commit 23a8373230
1 changed files with 7 additions and 5 deletions

View File

@ -13,6 +13,7 @@ local PATCH = nil
local help = true
local EncoreInitial = nil
local cv_teamchange
local scoreTable
-- Tracks if stats have been written or not
local StatTrack = false
@ -240,7 +241,7 @@ if f then
flags = tonumber(t[7])
end
local scoreTable = getScoreTable(tonumber(t[1]), flags) or {}
scoreTable = getScoreTable(tonumber(t[1]), flags) or {}
local spl = {}
if t[6] != nil then
@ -961,8 +962,6 @@ local function drawScoreboard(v, player)
if player != displayplayers[0] then return end
cachePatches(v)
local scoreTable = getScoreTable(gamemap, Flags)
local gui = cv_gui.value
if leveltime < START_TIME or player.exiting or player.lives == 0 then
@ -1010,7 +1009,7 @@ end
-- Find location of player and scroll to it
function scroll_to(player)
local m = getScoreTable(gamemap, Flags) or {}
local m = scoreTable or {}
scrollToPos = 2
for pos, score in ipairs(m) do
@ -1039,7 +1038,8 @@ local function writeStats()
end
local function saveTime(player)
local scoreTable = getScoreTable(gamemap, Flags) or {}
scoreTable = $ or {}
local pskin = skins[player.mo.skin]
local newscore = score_t(
@ -1242,6 +1242,8 @@ local function think()
end
end
scoreTable = getScoreTable(gamemap, Flags)
if not cv_teamchange then
cv_teamchange = CV_FindVar("allowteamchange")
end