Back to TPG

TPG.Loadout.Apply

S🏷️ Loadout

Part of TPG namespace

TPG.Loadout.Apply(ply)
View on GitHub|gamemode/player/sv_loadout.lua:200-363
📋 Has LDoc👁️ 2 viewsUpdated 6 days ago

Description

Strip and re-kit a player: weapons, armor, movement speed and ammo. Not on a team (spectator): only the default weapons and building tools, no team kit, no speed changes. On a team: reads the saved Primary/Secondary/ Special/Armor PData picks (a legacy non-string save falls back to the default loadout), charges premium picks through TPG.Gear.Claim if that system is loaded (a denial swaps in the free equivalent and messages why), applies armor stats, computes and sets walk/run speed from the resulting armor + weapon penalties BEFORE handing out any weapon (ACE's weapon base snapshots the owner's speed on Deploy, so setting it after would let a weapon deploy against the stale pre-loadout speed), then gives the actual weapons, tops up their ammo, and hands out a consolation disposable AT only if the Special slot came up empty. Underdog perks (smoke, medkit) are added last. Finishes by publishing pState.liveLoadout (what the player is actually carrying, which can differ from the PData picks after a denial), clearing the rekit flag, restamping speed via tpg.loadout.StampSpeed for weapons that never got a fresh Deploy snapshot, and syncing the gear menu's cooldowns.

Parameters

NameTypeDescription
plyPlayer

Returns

No return values documented.

Examples

No examples available.

Used In

No usages found in the codebase.