forked from Not/srb2k-leaderboard
Merge branch 'lonsfor-patch-1'
This commit is contained in:
commit
14645dbc90
@ -12,6 +12,8 @@ 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
|
||||||
|
|
||||||
-- Tracks if stats have been written or not
|
-- Tracks if stats have been written or not
|
||||||
local StatTrack = false
|
local StatTrack = false
|
||||||
@ -81,11 +83,24 @@ local cv_gui = CV_RegisterVar({
|
|||||||
PossibleValue = {Off = GUI_OFF, Splits = GUI_SPLITS, On = GUI_ON}
|
PossibleValue = {Off = GUI_OFF, Splits = GUI_SPLITS, On = GUI_ON}
|
||||||
})
|
})
|
||||||
|
|
||||||
local cv_afk = CV_RegisterVar({
|
local AntiAFK = true
|
||||||
|
CV_RegisterVar({
|
||||||
name = "lb_afk",
|
name = "lb_afk",
|
||||||
defaultvalue = 1,
|
defaultvalue = 1,
|
||||||
flags = CV_NETVAR,
|
flags = CV_NETVAR | CV_CALL,
|
||||||
PossibleValue = CV_OnOff
|
PossibleValue = CV_OnOff,
|
||||||
|
func = function(v)
|
||||||
|
-- Set players afkTime and toggle AntiAFK
|
||||||
|
if v.value then
|
||||||
|
for p in players.iterate do
|
||||||
|
p.afkTime = leveltime
|
||||||
|
end
|
||||||
|
|
||||||
|
AntiAFK = true
|
||||||
|
else
|
||||||
|
AntiAFK = false
|
||||||
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local cv_enable = CV_RegisterVar({
|
local cv_enable = CV_RegisterVar({
|
||||||
@ -239,7 +254,7 @@ if f then
|
|||||||
flags = tonumber(t[7])
|
flags = tonumber(t[7])
|
||||||
end
|
end
|
||||||
|
|
||||||
local scoreTable = getScoreTable(tonumber(t[1]), flags) or {}
|
scoreTable = getScoreTable(tonumber(t[1]), flags) or {}
|
||||||
|
|
||||||
local spl = {}
|
local spl = {}
|
||||||
if t[6] != nil then
|
if t[6] != nil then
|
||||||
@ -660,7 +675,7 @@ function ticsToTime(tics, pure)
|
|||||||
|
|
||||||
return string.format(
|
return string.format(
|
||||||
"%d:%02d:%02d",
|
"%d:%02d:%02d",
|
||||||
G_TicsToMinutes(tics),
|
G_TicsToMinutes(tics, true),
|
||||||
G_TicsToSeconds(tics),
|
G_TicsToSeconds(tics),
|
||||||
G_TicsToCentiseconds(tics)
|
G_TicsToCentiseconds(tics)
|
||||||
)
|
)
|
||||||
@ -907,10 +922,10 @@ local function drawScroll(v, player, scoreTable, gui)
|
|||||||
local x = 10
|
local x = 10
|
||||||
if #scoreTable >= 10 then
|
if #scoreTable >= 10 then
|
||||||
x = x + 8
|
x = x + 8
|
||||||
end
|
|
||||||
if #scoreTable >= 100 then
|
if #scoreTable >= 100 then
|
||||||
x = x + 8
|
x = x + 8
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local y = FixedInt(scrollY)
|
local y = FixedInt(scrollY)
|
||||||
|
|
||||||
@ -961,8 +976,6 @@ local function drawScoreboard(v, player)
|
|||||||
|
|
||||||
cachePatches(v)
|
cachePatches(v)
|
||||||
|
|
||||||
local scoreTable = getScoreTable(gamemap, Flags)
|
|
||||||
|
|
||||||
local gui = cv_gui.value
|
local gui = cv_gui.value
|
||||||
if leveltime < START_TIME or player.exiting or player.lives == 0 then
|
if leveltime < START_TIME or player.exiting or player.lives == 0 then
|
||||||
gui = GUI_ON
|
gui = GUI_ON
|
||||||
@ -1009,7 +1022,7 @@ end
|
|||||||
|
|
||||||
-- Find location of player and scroll to it
|
-- Find location of player and scroll to it
|
||||||
function scroll_to(player)
|
function scroll_to(player)
|
||||||
local m = getScoreTable(gamemap, Flags) or {}
|
local m = scoreTable or {}
|
||||||
|
|
||||||
scrollToPos = 2
|
scrollToPos = 2
|
||||||
for pos, score in ipairs(m) do
|
for pos, score in ipairs(m) do
|
||||||
@ -1038,7 +1051,8 @@ local function writeStats()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function saveTime(player)
|
local function saveTime(player)
|
||||||
local scoreTable = getScoreTable(gamemap, Flags) or {}
|
|
||||||
|
scoreTable = $ or {}
|
||||||
|
|
||||||
local pskin = skins[player.mo.skin]
|
local pskin = skins[player.mo.skin]
|
||||||
local newscore = score_t(
|
local newscore = score_t(
|
||||||
@ -1145,7 +1159,8 @@ local function think()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if disable then
|
if disable then
|
||||||
if cv_afk.value and ingame() > 1 then
|
if AntiAFK then
|
||||||
|
if ingame() > 1 then
|
||||||
for p in players.iterate do
|
for p in players.iterate do
|
||||||
if p.valid and not p.spectator and not p.exiting and p.lives > 0 then
|
if p.valid and not p.spectator and not p.exiting and p.lives > 0 then
|
||||||
if p.cmd.buttons then
|
if p.cmd.buttons then
|
||||||
@ -1170,6 +1185,7 @@ local function think()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
help = true
|
help = true
|
||||||
return
|
return
|
||||||
@ -1217,14 +1233,14 @@ local function think()
|
|||||||
end
|
end
|
||||||
if clearcheats then
|
if clearcheats then
|
||||||
clearcheats = false
|
clearcheats = false
|
||||||
for p in players.iterate do
|
for q in players.iterate do
|
||||||
p.SPBAKARTBIG = false
|
q.SPBAKARTBIG = false
|
||||||
p.SPBAjustice = false
|
q.SPBAjustice = false
|
||||||
p.SPBAshutup = false
|
q.SPBAshutup = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for p in players.iterate do
|
|
||||||
if not p.spectator then
|
if p then
|
||||||
if p.SPBAKARTBIG then
|
if p.SPBAKARTBIG then
|
||||||
Flags = $ | F_SPBBIG
|
Flags = $ | F_SPBBIG
|
||||||
end
|
end
|
||||||
@ -1232,14 +1248,19 @@ local function think()
|
|||||||
Flags = $ | F_SPBJUS
|
Flags = $ | F_SPBJUS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if not (Flags & F_SPBATK) then
|
if not (Flags & F_SPBATK) then
|
||||||
hud.enable("freeplay")
|
hud.enable("freeplay")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local cv_teamchange = CV_FindVar("allowteamchange")
|
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
|
||||||
@ -1292,11 +1313,17 @@ local function interThink()
|
|||||||
COM_BufInsertText(server, "map " + nextMap)
|
COM_BufInsertText(server, "map " + nextMap)
|
||||||
nextMap = nil
|
nextMap = nil
|
||||||
end
|
end
|
||||||
if not CV_FindVar("allowteamchange").value then
|
|
||||||
|
if not cv_teamchange then
|
||||||
|
cv_teamchange = CV_FindVar("allowteamchange")
|
||||||
|
end
|
||||||
|
|
||||||
|
if not cv_teamchange.value then
|
||||||
allowJoin(true)
|
allowJoin(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
addHook("IntermissionThinker", interThink)
|
addHook("IntermissionThinker", interThink)
|
||||||
|
addHook("VoteThinker", interThink)
|
||||||
|
|
||||||
-- Returns the values clamed between min, max
|
-- Returns the values clamed between min, max
|
||||||
function clamp(min_v, v, max_v)
|
function clamp(min_v, v, max_v)
|
||||||
|
Loading…
Reference in New Issue
Block a user