mirror of
https://github.com/StyledStrike/gmod-custom-loadout.git
synced 2025-03-04 03:03:09 -05:00
Much higher item limit on single player
This commit is contained in:
parent
dba1d835e6
commit
0f9613ef36
@ -9,6 +9,14 @@ function CLoadout.PrintF( str, ... )
|
||||
MsgC( Color( 255, 94, 0 ), "[Custom Loadout] ", Color( 255, 255, 255 ), string.format( str, ... ), "\n" )
|
||||
end
|
||||
|
||||
function CLoadout:GetWeaponLimit()
|
||||
if game.SinglePlayer() then return 200 end
|
||||
|
||||
local cvarWeaponLimit = GetConVar( "custom_loadout_max_items" )
|
||||
|
||||
return cvarWeaponLimit and cvarWeaponLimit:GetInt() or 40
|
||||
end
|
||||
|
||||
function CLoadout:IsBlacklisted( ply, class )
|
||||
local blacklisted = hook.Run( "CustomLoadout.IsWeaponBlacklisted", ply, class )
|
||||
if tobool( blacklisted ) then return true end
|
||||
|
@ -64,12 +64,6 @@ function CLoadout:InitRegistry()
|
||||
self.weaponRegistry = registry
|
||||
end
|
||||
|
||||
function CLoadout:GetWeaponLimit()
|
||||
local cvarWeaponLimit = GetConVar( "custom_loadout_max_items" )
|
||||
|
||||
return cvarWeaponLimit and cvarWeaponLimit:GetInt() or 25
|
||||
end
|
||||
|
||||
function CLoadout:GetAmmoLimits()
|
||||
local cvarPrimaryLimit = GetConVar( "custom_loadout_primary_limit" )
|
||||
local cvarSecondaryLimit = GetConVar( "custom_loadout_secondary_limit" )
|
||||
|
@ -16,13 +16,15 @@ local cvarSecondaryLimit = CreateConVar(
|
||||
0, 9999
|
||||
)
|
||||
|
||||
local cvarWeaponLimit = CreateConVar(
|
||||
"custom_loadout_max_items",
|
||||
"40",
|
||||
bit.bor( FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_NOTIFY ),
|
||||
"[Custom Loadout] Limits how many weapons a single loadout can have.",
|
||||
0, 100
|
||||
)
|
||||
if not game.SinglePlayer() then
|
||||
CreateConVar(
|
||||
"custom_loadout_max_items",
|
||||
"40",
|
||||
bit.bor( FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_NOTIFY ),
|
||||
"[Custom Loadout] Limits how many weapons a single loadout can have.",
|
||||
0, 100
|
||||
)
|
||||
end
|
||||
|
||||
-- store player loadouts
|
||||
CLoadout.cache = {}
|
||||
@ -152,7 +154,7 @@ function CLoadout:ReceiveData( len, ply )
|
||||
-- no need to go further if the loadout is not enabled
|
||||
if not loadout.enabled then return end
|
||||
|
||||
local maxItems = cvarWeaponLimit:GetInt()
|
||||
local maxItems = self:GetWeaponLimit()
|
||||
local count = 0
|
||||
|
||||
-- filter inexistent weapons, and limit the items
|
||||
|
Loading…
Reference in New Issue
Block a user