xlib: Add helpers for bypassing some replicated cvars when listen server host

- Will help resolve issues where replicated cvar sliders on the gmod admin menu spaz out
This commit is contained in:
SticklyMan 2023-11-21 05:31:44 -07:00 committed by SticklyMan
parent 97203ca256
commit 3b957bef5e
2 changed files with 16 additions and 1 deletions

View File

@ -1227,3 +1227,18 @@ local function fadeAnim_end( data )
if data.panelIn then data.panelIn:SetAlpha( 255 ) end
end
xlib.registerAnimType( "pnlFade", fadeAnim_run, fadeAnim_start, fadeAnim_end )
-------------------------
-- Convar/Listen helpers
-------------------------
-- Useful for switching between cvar or replicated cvar depending on if the player is the host
xlib.ifListenHost = function(value)
if LocalPlayer():IsListenServerHost() then return value end
return nil
end
xlib.ifNotListenHost = function(value)
if not LocalPlayer():IsListenServerHost() then return value end
return nil
end

View File

@ -1 +1 @@
1700569188
1700569904