attempt at clearing long cache in ubgl 2 revert if not working

This commit is contained in:
Darsu 2024-07-21 09:58:07 +07:00
parent d19a5b0e92
commit 018acb2f0d
2 changed files with 13 additions and 5 deletions

View File

@ -30,13 +30,16 @@ local quickmodifiers = {
local singleplayer = game.SinglePlayer()
local ARC9HeatCapacityGPVOverflow = false
function SWEP:ClearLongCache()
for _, v in pairs(self.PV_CacheLong) do v.time = 0 end
end
function SWEP:InvalidateCache()
if singleplayer and self:GetOwner():IsPlayer() then
self:CallOnClient("InvalidateCache")
end
for _, v in pairs(self.PV_CacheLong) do v.time = 0 end
-- self.PV_CacheLong = {}
self:ClearLongCache()
self.StatCache = {}
self.HookCache = {}

View File

@ -27,6 +27,8 @@ function SWEP:ThinkUBGL()
end
end
local singleplayer = game.SinglePlayer()
function SWEP:ToggleUBGL(on)
if on == nil then on = !self:GetUBGL() end
if self:GetReloading() then on = false end
@ -41,8 +43,11 @@ function SWEP:ToggleUBGL(on)
self:CancelReload()
self:SetUBGL(on)
for _, v in pairs(self.PV_CacheLong) do v.time = 0 end -- reset cache so ubgl stats wont mix with normal gun
if singleplayer and self:GetOwner():IsPlayer() then
self:CallOnClient("ClearLongCache")
end
self:ClearLongCache()
if on then
local soundtab = {
name = "enterubgl",
@ -55,7 +60,7 @@ function SWEP:ToggleUBGL(on)
self:PlayAnimation("enter_ubgl", 1, true)
self:ExitSights()
if game.SinglePlayer() then
if singleplayer then
self:CallOnClient("RecalculateIKGunMotionOffset")
end
else