From 6570ae0d2d2115f024d73018793c4248b9382a18 Mon Sep 17 00:00:00 2001 From: Matt Jeanes Date: Sat, 30 Nov 2024 01:02:51 +0000 Subject: [PATCH] performance hotfix --- lua/tardis/sh_aprilfools.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lua/tardis/sh_aprilfools.lua b/lua/tardis/sh_aprilfools.lua index 4a019c1fb..629a956e9 100644 --- a/lua/tardis/sh_aprilfools.lua +++ b/lua/tardis/sh_aprilfools.lua @@ -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