Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
c0a296df69 | |||
b040fdd933 | |||
70cd579079 |
335
leaderboard.lua
335
leaderboard.lua
@ -1,4 +1,5 @@
|
|||||||
-- Leaderboards written by Not
|
-- Leaderboards written by Not
|
||||||
|
-- Reusable
|
||||||
|
|
||||||
local FILENAME = "leaderboard.txt"
|
local FILENAME = "leaderboard.txt"
|
||||||
local lb = {}
|
local lb = {}
|
||||||
@ -8,6 +9,7 @@ local prevLap = 0
|
|||||||
local splits = {}
|
local splits = {}
|
||||||
local PATCH = nil
|
local PATCH = nil
|
||||||
local help = true
|
local help = true
|
||||||
|
local UNCLAIMED = "Unclaimed Record"
|
||||||
|
|
||||||
-- Retry / changelevel map
|
-- Retry / changelevel map
|
||||||
local nextMap = nil
|
local nextMap = nil
|
||||||
@ -27,9 +29,57 @@ local AFK_TIMEOUT = TICRATE * 5
|
|||||||
local AFK_BALANCE = TICRATE * 60
|
local AFK_BALANCE = TICRATE * 60
|
||||||
local PREVENT_JOIN_TIME = START_TIME + TICRATE * 5
|
local PREVENT_JOIN_TIME = START_TIME + TICRATE * 5
|
||||||
|
|
||||||
|
local GUI_OFF = 0x0
|
||||||
|
local GUI_SPLITS = 0x1
|
||||||
|
local GUI_ON = 0x2
|
||||||
|
|
||||||
-- patch caching function
|
-- patch caching function
|
||||||
local cachePatches
|
local cachePatches
|
||||||
|
|
||||||
|
local cv_gui = CV_RegisterVar({
|
||||||
|
name = "lb_gui",
|
||||||
|
defaultvalue = GUI_ON,
|
||||||
|
flags = 0,
|
||||||
|
PossibleValue = {Off = GUI_OFF, Splits = GUI_SPLITS, On = GUI_ON}
|
||||||
|
})
|
||||||
|
|
||||||
|
local cv_afk = CV_RegisterVar({
|
||||||
|
name = "lb_afk",
|
||||||
|
defaultvalue = 1,
|
||||||
|
flags = CV_NETVAR,
|
||||||
|
PossibleValue = CV_OnOff
|
||||||
|
})
|
||||||
|
|
||||||
|
local cv_enable = CV_RegisterVar({
|
||||||
|
name = "lb_enable",
|
||||||
|
defaultvalue = 1,
|
||||||
|
flags = CV_NETVAR | CV_CALL,
|
||||||
|
PossibleValue = CV_OnOff,
|
||||||
|
func = function(v)
|
||||||
|
disable = $ or not v.value
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
local cv_saves = CV_RegisterVar({
|
||||||
|
name = "lb_save_count",
|
||||||
|
defaultvalue = 20,
|
||||||
|
flags = CV_NETVAR,
|
||||||
|
PossibleValue = CV_Natural
|
||||||
|
})
|
||||||
|
|
||||||
|
local cv_interrupt = CV_RegisterVar({
|
||||||
|
name = "lb_interrupt",
|
||||||
|
defaultvalue = 0,
|
||||||
|
flags = CV_NETVAR | CV_CALL,
|
||||||
|
PossibleValue = CV_OnOff,
|
||||||
|
func = function(v)
|
||||||
|
if v.value then
|
||||||
|
COM_BufInsertText(server, "allowteamchange yes")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
local function lbID(map, flags)
|
local function lbID(map, flags)
|
||||||
local id = tostring(map)
|
local id = tostring(map)
|
||||||
if flags & F_SPBATK then
|
if flags & F_SPBATK then
|
||||||
@ -99,16 +149,18 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function allowJoin(v)
|
local function allowJoin(v)
|
||||||
local y
|
if not cv_interrupt.value then
|
||||||
if v then
|
local y
|
||||||
y = "yes"
|
if v then
|
||||||
hud.enable("freeplay")
|
y = "yes"
|
||||||
else
|
hud.enable("freeplay")
|
||||||
y = "no"
|
else
|
||||||
hud.disable("freeplay")
|
y = "no"
|
||||||
end
|
hud.disable("freeplay")
|
||||||
|
end
|
||||||
|
|
||||||
COM_BufInsertText(server, "allowteamchange " + y)
|
COM_BufInsertText(server, "allowteamchange " + y)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ingame()
|
local function ingame()
|
||||||
@ -127,7 +179,8 @@ local function initLeaderboard(player)
|
|||||||
else
|
else
|
||||||
disable = disable or ingame() > 1
|
disable = disable or ingame() > 1
|
||||||
end
|
end
|
||||||
player.afkTimeout = leveltime
|
disable = $ or not cv_enable.value
|
||||||
|
player.afkTime = leveltime
|
||||||
end
|
end
|
||||||
addHook("PlayerSpawn", initLeaderboard)
|
addHook("PlayerSpawn", initLeaderboard)
|
||||||
|
|
||||||
@ -157,6 +210,33 @@ local function exitlevel(player, ...)
|
|||||||
end
|
end
|
||||||
COM_AddCommand("exit", exitlevel)
|
COM_AddCommand("exit", exitlevel)
|
||||||
|
|
||||||
|
local function findMap(player, ...)
|
||||||
|
local search = ...
|
||||||
|
if search == nil then
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, #mapheaderinfo do
|
||||||
|
local map = mapheaderinfo[i]
|
||||||
|
if map == nil then
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
|
||||||
|
if map.lvlttl:lower():find(search:lower()) then
|
||||||
|
CONS_Printf(
|
||||||
|
player,
|
||||||
|
string.format(
|
||||||
|
"%s - %s",
|
||||||
|
G_BuildMapName(i),
|
||||||
|
map.lvlttl
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
COM_AddCommand("findmap", findMap)
|
||||||
|
|
||||||
local function mapNotExists(player, map)
|
local function mapNotExists(player, map)
|
||||||
CONS_Printf(player, string.format("Map doesn't exist: %s", map:upper()))
|
CONS_Printf(player, string.format("Map doesn't exist: %s", map:upper()))
|
||||||
end
|
end
|
||||||
@ -194,8 +274,11 @@ local function changelevel(player, ...)
|
|||||||
else
|
else
|
||||||
--Extended map numbers
|
--Extended map numbers
|
||||||
p = ALPH:find(p) - 1
|
p = ALPH:find(p) - 1
|
||||||
q = (tonumber(q) or ALPH:find(q) + 9)
|
local qn = tonumber(q)
|
||||||
mapnum = 36 * p + q + 100
|
if qn == nil then
|
||||||
|
qn = ALPH:find(q) + 9
|
||||||
|
end
|
||||||
|
mapnum = 36 * p + qn + 100
|
||||||
end
|
end
|
||||||
|
|
||||||
if mapheaderinfo[mapnum] == nil then
|
if mapheaderinfo[mapnum] == nil then
|
||||||
@ -247,6 +330,10 @@ addHook("MapLoad", function()
|
|||||||
)
|
)
|
||||||
|
|
||||||
local function ticsToTime(tics)
|
local function ticsToTime(tics)
|
||||||
|
if tics == 0 then
|
||||||
|
return "-:--:--"
|
||||||
|
end
|
||||||
|
|
||||||
return string.format(
|
return string.format(
|
||||||
"%d:%02d:%02d",
|
"%d:%02d:%02d",
|
||||||
G_TicsToMinutes(tics),
|
G_TicsToMinutes(tics),
|
||||||
@ -268,93 +355,55 @@ local function drawitem(v, x, y, scale, itempatch, vflags)
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local cursors = {
|
||||||
|
[1] = ". ",
|
||||||
|
[2] = " ."
|
||||||
|
}
|
||||||
local function marquee(text, maxwidth)
|
local function marquee(text, maxwidth)
|
||||||
if #text <= maxwidth then
|
if #text <= maxwidth then
|
||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
|
||||||
local shift = 16
|
local shift = 16
|
||||||
|
|
||||||
|
-- Creates an index range ranging from -shift to #text + shift
|
||||||
local pos = ((leveltime / 16) % (#text - maxwidth + shift * 2)) + 1 - shift
|
local pos = ((leveltime / 16) % (#text - maxwidth + shift * 2)) + 1 - shift
|
||||||
|
|
||||||
|
local cursor = ""
|
||||||
|
if pos < #text - maxwidth + 1 then
|
||||||
|
cursor = cursors[((leveltime / 11) % #cursors) + 1]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The pos is the index going from -shift to #text + shift
|
||||||
|
-- It's clamped within the text boundaries ie.
|
||||||
|
-- 0 < pos < #text - maxwidth
|
||||||
pos = min(max(pos, 1), #text - maxwidth + 1)
|
pos = min(max(pos, 1), #text - maxwidth + 1)
|
||||||
return text:sub(pos, pos + maxwidth - 1)
|
return text:sub(pos, pos + maxwidth - 1) + cursor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Bats on ...
|
||||||
local bodium = {V_YELLOWMAP, V_GRAYMAP, V_BROWNMAP, 0}
|
local bodium = {V_YELLOWMAP, V_GRAYMAP, V_BROWNMAP, 0}
|
||||||
|
|
||||||
local splitColor = {[true]=V_SKYMAP, [false]=V_REDMAP}
|
local splitColor = {[true]=V_SKYMAP, [false]=V_REDMAP}
|
||||||
local splitSymbol = {[true]="-", [false]="+"}
|
local splitSymbol = {[true]="-", [false]="+"}
|
||||||
|
|
||||||
local showSplit = 0
|
local showSplit = 0
|
||||||
local VFLAGS = V_SNAPTOLEFT
|
local VFLAGS = V_SNAPTOLEFT
|
||||||
local function drawScoreboard(v, player)
|
local FACERANK_DIM = 16
|
||||||
if disable then return end
|
local function drawScore(v, player, i, gui, faceRank, color, name, time, sSplits, flags)
|
||||||
if player != displayplayers[0] then return end
|
--draw Patch/chili
|
||||||
|
-- | OFFSET | + | PADDING | * |INDEX|
|
||||||
|
local h = ((200 / 4) + 4) + (FACERANK_DIM + 4) * (i - 1)
|
||||||
|
|
||||||
cachePatches(v)
|
v.draw(4, h, faceRank, V_HUDTRANS | VFLAGS, v.getColormap("sonic", color))
|
||||||
|
if player.name == name then
|
||||||
local m = lb[lbID(gamemap, Flags)]
|
v.draw(4, h, PATCH["CHILI"][(leveltime / 4) % 8], V_HUDTRANS | VFLAGS)
|
||||||
if m == nil then
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, score in ipairs(m) do
|
--draw icons
|
||||||
local name = score["name"]
|
|
||||||
local skin = skins[score["skin"]]
|
--draw name
|
||||||
if skin == nil then
|
if gui == GUI_ON or (gui == GUI_SPLITS and showSplit) then
|
||||||
skin = skins["sonic"]
|
|
||||||
end
|
|
||||||
local skinPatch = PATCH["FACERANK"][skin.name]
|
|
||||||
|
|
||||||
-- | OFFSET | + | PADDING | * |INDEX|
|
|
||||||
local h = ((200 / 4) + 4) + (skinPatch.height + 4) * (i - 1)
|
|
||||||
|
|
||||||
v.draw(4, h, skinPatch, V_HUDTRANS | VFLAGS, v.getColormap("sonic", score["color"]))
|
|
||||||
if player.name == name then
|
|
||||||
v.draw(4, h, PATCH["CHILI"][(leveltime / 4) % 8], V_HUDTRANS | VFLAGS)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- SPB
|
|
||||||
if score["flags"] & F_SPBATK then
|
|
||||||
local scale = FRACUNIT / 4
|
|
||||||
drawitem(
|
|
||||||
v,
|
|
||||||
4 - 2,
|
|
||||||
h - 2,
|
|
||||||
scale,
|
|
||||||
PATCH["SPB"],
|
|
||||||
V_HUDTRANS | VFLAGS
|
|
||||||
)
|
|
||||||
if score["flags"] & F_SPBEXP then
|
|
||||||
drawitem(
|
|
||||||
v,
|
|
||||||
skinPatch.width,
|
|
||||||
h - 2,
|
|
||||||
scale,
|
|
||||||
PATCH["INV"][(leveltime / 4) % 6],
|
|
||||||
V_HUDTRANS | VFLAGS
|
|
||||||
)
|
|
||||||
end
|
|
||||||
if score["flags"] & F_SPBBIG then
|
|
||||||
drawitem(
|
|
||||||
v,
|
|
||||||
4 - 2,
|
|
||||||
h + skinPatch.height - 4,
|
|
||||||
scale,
|
|
||||||
PATCH["BIG"],
|
|
||||||
V_HUDTRANS | VFLAGS
|
|
||||||
)
|
|
||||||
end
|
|
||||||
if score["flags"] & F_SPBJUS then
|
|
||||||
drawitem(
|
|
||||||
v,
|
|
||||||
skinPatch.width,
|
|
||||||
h + skinPatch.height - 4,
|
|
||||||
scale,
|
|
||||||
PATCH["HYUD"],
|
|
||||||
V_HUDTRANS | VFLAGS
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Shorten long names
|
-- Shorten long names
|
||||||
local stralign = "left"
|
local stralign = "left"
|
||||||
local MAXWIDTH = 70
|
local MAXWIDTH = 70
|
||||||
@ -372,8 +421,51 @@ local function drawScoreboard(v, player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- SPB
|
||||||
|
if flags & F_SPBATK then
|
||||||
|
local scale = FRACUNIT / 4
|
||||||
|
drawitem(
|
||||||
|
v,
|
||||||
|
4 - 2,
|
||||||
|
h - 2,
|
||||||
|
scale,
|
||||||
|
PATCH["SPB"],
|
||||||
|
V_HUDTRANS | VFLAGS
|
||||||
|
)
|
||||||
|
if flags & F_SPBEXP then
|
||||||
|
drawitem(
|
||||||
|
v,
|
||||||
|
FACERANK_DIM,
|
||||||
|
h - 2,
|
||||||
|
scale,
|
||||||
|
PATCH["INV"][(leveltime / 4) % 6],
|
||||||
|
V_HUDTRANS | VFLAGS
|
||||||
|
)
|
||||||
|
end
|
||||||
|
if flags & F_SPBBIG then
|
||||||
|
drawitem(
|
||||||
|
v,
|
||||||
|
4 - 2,
|
||||||
|
h + FACERANK_DIM - 4,
|
||||||
|
scale,
|
||||||
|
PATCH["BIG"],
|
||||||
|
V_HUDTRANS | VFLAGS
|
||||||
|
)
|
||||||
|
end
|
||||||
|
if flags & F_SPBJUS then
|
||||||
|
drawitem(
|
||||||
|
v,
|
||||||
|
FACERANK_DIM,
|
||||||
|
h + FACERANK_DIM - 4,
|
||||||
|
scale,
|
||||||
|
PATCH["HYUD"],
|
||||||
|
V_HUDTRANS | VFLAGS
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
v.drawString(
|
v.drawString(
|
||||||
px + skinPatch.width,
|
px + FACERANK_DIM,
|
||||||
h + py,
|
h + py,
|
||||||
name,
|
name,
|
||||||
V_HUDTRANSHALF | V_ALLOWLOWERCASE | VFLAGS,
|
V_HUDTRANSHALF | V_ALLOWLOWERCASE | VFLAGS,
|
||||||
@ -381,24 +473,62 @@ local function drawScoreboard(v, player)
|
|||||||
)
|
)
|
||||||
|
|
||||||
-- Draw splits
|
-- Draw splits
|
||||||
if showSplit > 0 and score["splits"][prevLap] != nil then
|
if showSplit and sSplits and sSplits[prevLap] != nil then
|
||||||
local split = splits[prevLap] - score["splits"][prevLap]
|
local split = splits[prevLap] - sSplits[prevLap]
|
||||||
v.drawString(
|
v.drawString(
|
||||||
px + skinPatch.width,
|
px + FACERANK_DIM,
|
||||||
h + 8,
|
h + 8,
|
||||||
splitSymbol[split < 0] + ticsToTime(abs(split)),
|
splitSymbol[split < 0] + ticsToTime(abs(split)),
|
||||||
V_HUDTRANSHALF | splitColor[split < 0] | VFLAGS
|
V_HUDTRANSHALF | splitColor[split < 0] | VFLAGS
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
v.drawString(
|
v.drawString(
|
||||||
px + skinPatch.width,
|
px + FACERANK_DIM,
|
||||||
h + 8,
|
h + 8,
|
||||||
ticsToTime(score["time"]),
|
ticsToTime(time),
|
||||||
V_HUDTRANSHALF | bodium[min(i, 4)] | VFLAGS
|
V_HUDTRANSHALF | bodium[min(i, 4)] | VFLAGS
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function drawScoreboard(v, player)
|
||||||
|
if disable then return end
|
||||||
|
if player != displayplayers[0] then return end
|
||||||
|
|
||||||
|
cachePatches(v)
|
||||||
|
|
||||||
|
local m = lb[lbID(gamemap, Flags)]
|
||||||
|
--if m == nil then
|
||||||
|
-- return
|
||||||
|
--end
|
||||||
|
|
||||||
|
local gui = cv_gui.value
|
||||||
|
if leveltime < START_TIME or player.exiting or player.lives == 0 then
|
||||||
|
gui = GUI_ON
|
||||||
|
end
|
||||||
|
|
||||||
|
if gui then
|
||||||
|
-- Draw placeholder score
|
||||||
|
if m == nil then
|
||||||
|
drawScore(v, player, 1, gui, PATCH["NORANK"], nil, UNCLAIMED, 0, nil, 0)
|
||||||
|
else
|
||||||
|
for i, score in ipairs(m) do
|
||||||
|
if i > 5 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
local name = score["name"]
|
||||||
|
local skin = skins[score["skin"]]
|
||||||
|
if skin == nil then
|
||||||
|
skin = skins["sonic"]
|
||||||
|
end
|
||||||
|
local faceRank = PATCH["FACERANK"][skin.name]
|
||||||
|
drawScore(v, player, i, gui, faceRank, score["color"], score["name"], score["time"], score["splits"], score["flags"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
hud.add(drawScoreboard, "game")
|
hud.add(drawScoreboard, "game")
|
||||||
|
|
||||||
function cachePatches(v)
|
function cachePatches(v)
|
||||||
@ -410,6 +540,8 @@ function cachePatches(v)
|
|||||||
PATCH["CHILI"][i-1] = v.cachePatch("K_CHILI" + i)
|
PATCH["CHILI"][i-1] = v.cachePatch("K_CHILI" + i)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
PATCH["NORANK"] = v.cachePatch("M_NORANK")
|
||||||
|
|
||||||
PATCH["FACERANK"] = {}
|
PATCH["FACERANK"] = {}
|
||||||
for skin in skins.iterate do
|
for skin in skins.iterate do
|
||||||
PATCH["FACERANK"][skin.name] = v.cachePatch(skin.facerank)
|
PATCH["FACERANK"][skin.name] = v.cachePatch(skin.facerank)
|
||||||
@ -432,7 +564,7 @@ local function lbComp(a, b)
|
|||||||
-- if s is negative then b is harder
|
-- if s is negative then b is harder
|
||||||
-- if s is 0 then compare time
|
-- if s is 0 then compare time
|
||||||
local s = (a["flags"] & (F_SPBEXP | F_SPBBIG)) - (b["flags"] & (F_SPBEXP | F_SPBBIG))
|
local s = (a["flags"] & (F_SPBEXP | F_SPBBIG)) - (b["flags"] & (F_SPBEXP | F_SPBBIG))
|
||||||
return s > 0 or not(s < 0 or a["time"] > b["time"])
|
return s > 0 or not(s < 0 or a["time"] >= b["time"])
|
||||||
end
|
end
|
||||||
|
|
||||||
local function saveTime(player)
|
local function saveTime(player)
|
||||||
@ -472,7 +604,7 @@ local function saveTime(player)
|
|||||||
)
|
)
|
||||||
|
|
||||||
table.sort(m, lbComp)
|
table.sort(m, lbComp)
|
||||||
while #m > 5 do
|
while #m > cv_saves.value do
|
||||||
table.remove(m)
|
table.remove(m)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -504,7 +636,7 @@ end
|
|||||||
|
|
||||||
-- DEBUGGING
|
-- DEBUGGING
|
||||||
--local function saveLeaderboard(player, ...)
|
--local function saveLeaderboard(player, ...)
|
||||||
-- timeFinished = player.realtime
|
-- timeFinished = tonumber(... or player.realtime)
|
||||||
-- splits = {1000, 2000, 3000}
|
-- splits = {1000, 2000, 3000}
|
||||||
-- saveTime(player)
|
-- saveTime(player)
|
||||||
--end
|
--end
|
||||||
@ -533,13 +665,13 @@ local function think()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if disable then
|
if disable then
|
||||||
if ingame() > 1 then
|
if cv_afk.value and 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 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
|
||||||
p.afkTimeout = leveltime
|
p.afkTime = leveltime
|
||||||
end
|
end
|
||||||
if p.afkTimeout + AFK_BALANCE < leveltime then
|
if p.afkTime + AFK_BALANCE < leveltime then
|
||||||
p.spectator = true
|
p.spectator = true
|
||||||
chatprint("\x89" + p.name + " was moved to the other team for game balance", true)
|
chatprint("\x89" + p.name + " was moved to the other team for game balance", true)
|
||||||
end
|
end
|
||||||
@ -548,7 +680,7 @@ local function think()
|
|||||||
else
|
else
|
||||||
for p in players.iterate do
|
for p in players.iterate do
|
||||||
if p.valid and not p.spectator then
|
if p.valid and not p.spectator then
|
||||||
p.afkTimeout = leveltime
|
p.afkTime = leveltime
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -567,7 +699,7 @@ local function think()
|
|||||||
if ingame() == 1 then
|
if ingame() == 1 then
|
||||||
if help then
|
if help then
|
||||||
help = false
|
help = false
|
||||||
chatprint("\x89Leaderboard Commands:\nretry exit findmap changelevel spba_clearcheats", true)
|
chatprint("\x89Leaderboard Commands:\nretry exit findmap changelevel spba_clearcheats lb_gui", true)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
help = true
|
help = true
|
||||||
@ -611,19 +743,22 @@ local function think()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not (Flags & F_SPBATK) then
|
||||||
|
hud.enable("freeplay")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local cv_teamchange = CV_FindVar("allowteamchange")
|
local cv_teamchange = CV_FindVar("allowteamchange")
|
||||||
if p then
|
if p then
|
||||||
if p.cmd.buttons then
|
if p.cmd.buttons then
|
||||||
p.afkTimeout = leveltime
|
p.afkTime = leveltime
|
||||||
end
|
end
|
||||||
|
|
||||||
if leveltime > PREVENT_JOIN_TIME and p.afkTimeout + AFK_TIMEOUT > leveltime then
|
if leveltime > PREVENT_JOIN_TIME and p.afkTime + AFK_TIMEOUT > leveltime then
|
||||||
if cv_teamchange.value then
|
if cv_teamchange.value then
|
||||||
allowJoin(false)
|
allowJoin(false)
|
||||||
end
|
end
|
||||||
elseif p.afkTimeout + AFK_TIMEOUT < leveltime then
|
elseif p.afkTime + AFK_TIMEOUT < leveltime then
|
||||||
if not cv_teamchange.value then
|
if not cv_teamchange.value then
|
||||||
allowJoin(true)
|
allowJoin(true)
|
||||||
end
|
end
|
||||||
@ -653,5 +788,7 @@ addHook("IntermissionThinker", interThink)
|
|||||||
|
|
||||||
local function netvars(net)
|
local function netvars(net)
|
||||||
lb = net($)
|
lb = net($)
|
||||||
|
splits = net($)
|
||||||
|
prevLap = net($)
|
||||||
end
|
end
|
||||||
addHook("NetVars", netvars)
|
addHook("NetVars", netvars)
|
||||||
|
Reference in New Issue
Block a user