Skip to content

Commit

Permalink
performance hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
MattJeanes committed Nov 30, 2024
1 parent 6e1fd2a commit 6570ae0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lua/tardis/sh_aprilfools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,22 @@ CreateConVar("tardis2_aprilfools_2023", 1, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "0
function TARDIS:IsAprilFools()
local aprilFools = cvars.Number("tardis2_aprilfools_2023")

if CLIENT and aprilFools ~= self.aprilFoolsLast then
if aprilFools ~= self.aprilFoolsLast then
self.aprilFoolsLast = aprilFools
RunConsoleCommand("spawnmenu_reload")
self.aprilFoolsCache = nil
if CLIENT then
RunConsoleCommand("spawnmenu_reload")
end
end

if self.aprilFoolsCache ~= nil then
return self.aprilFoolsCache
end

self.aprilFoolsCache = self:IsAprilFoolsInternal(aprilFools)
end

function TARDIS:IsAprilFoolsInternal(aprilFools)
if aprilFools == 1 and os.date("%d/%m") == "01/04" then
return true
elseif aprilFools == 2 then
Expand Down

0 comments on commit 6570ae0

Please sign in to comment.