Compare commits

..

3 Commits

Author SHA1 Message Date
Not
14645dbc90 Merge branch 'lonsfor-patch-1' 2022-05-12 12:17:36 +02:00
Not
6c7cdf34b9 set players afkTime before enabling antiAFK 2022-05-12 12:14:48 +02:00
Not
8a6161a1e1 prevent netvar changes in replays 2022-04-30 15:50:23 +02:00

View File

@ -83,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({
@ -1146,7 +1159,7 @@ local function think()
end end
if disable then if disable then
if cv_afk.value then if AntiAFK then
if ingame() > 1 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
@ -1272,13 +1285,15 @@ local function think()
p.afkTime = leveltime p.afkTime = leveltime
end end
if leveltime > PREVENT_JOIN_TIME and p.afkTime + AFK_TIMEOUT > leveltime then if not replayplayback then
if cv_teamchange.value then if leveltime > PREVENT_JOIN_TIME and p.afkTime + AFK_TIMEOUT > leveltime then
allowJoin(false) if cv_teamchange.value then
end allowJoin(false)
elseif p.afkTime + AFK_TIMEOUT < leveltime then end
if not cv_teamchange.value then elseif p.afkTime + AFK_TIMEOUT < leveltime then
allowJoin(true) if not cv_teamchange.value then
allowJoin(true)
end
end end
end end