mirror of
https://github.com/HaodongMo/ARC-9.git
synced 2025-03-04 03:02:58 -05:00
cache for dyn stats now has one tick lifetime
This commit is contained in:
parent
ad37026066
commit
ba4846fcc0
@ -429,6 +429,8 @@ do
|
|||||||
local cvarArc9Truenames = GetConVar("arc9_truenames")
|
local cvarArc9Truenames = GetConVar("arc9_truenames")
|
||||||
local cvarGetBool = FindMetaTable("ConVar").GetBool
|
local cvarGetBool = FindMetaTable("ConVar").GetBool
|
||||||
local vectorLength = FindMetaTable("Vector").Length
|
local vectorLength = FindMetaTable("Vector").Length
|
||||||
|
local engineTickInterval = engine.TickInterval
|
||||||
|
local engineTickCount = engine.TickCount
|
||||||
|
|
||||||
local getmetatable = getmetatable
|
local getmetatable = getmetatable
|
||||||
local numberMeta = getmetatable(1)
|
local numberMeta = getmetatable(1)
|
||||||
@ -454,12 +456,13 @@ do
|
|||||||
local ct = CurTime()
|
local ct = CurTime()
|
||||||
local upct = UnPredictedCurTime()
|
local upct = UnPredictedCurTime()
|
||||||
local processedValueName = tostring(val) .. tostring(base)
|
local processedValueName = tostring(val) .. tostring(base)
|
||||||
|
local ticks = engineTickCount()
|
||||||
|
|
||||||
-- if CLIENT then -- why cache was client only???
|
-- if CLIENT then -- why cache was client only???
|
||||||
if self.PV_Cache[processedValueName] ~= nil and self.PV_Tick == upct then
|
if self.PV_Cache[processedValueName] ~= nil and self.PV_Tick >= ticks then
|
||||||
return self.PV_Cache[processedValueName]
|
return self.PV_Cache[processedValueName]
|
||||||
end
|
end
|
||||||
if self.PV_Tick ~= upct then
|
if self.PV_Tick < ticks then
|
||||||
self.PV_Cache = {}
|
self.PV_Cache = {}
|
||||||
end
|
end
|
||||||
-- end
|
-- end
|
||||||
@ -697,7 +700,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- if CLIENT then
|
-- if CLIENT then
|
||||||
self.PV_Tick = upct
|
self.PV_Tick = ticks + engineTickInterval()
|
||||||
self.PV_Cache[processedValueName] = stat
|
self.PV_Cache[processedValueName] = stat
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user