Each TF2 player carries an inventory ofDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sr2echa/TF2-Source-Code/llms.txt
Use this file to discover all available pages before exploring further.
CEconItemView objects representing their owned items. On the server, each CTFPlayer instance holds a CTFPlayerInventory that exposes the active loadout — what weapon or cosmetic is equipped in each slot. The inventory data is synchronized from the Steam Game Coordinator (GC) via CGCClientSystem.
CTFPlayerInventory
CTFPlayerInventory (game/shared/tf/tf_item_inventory.h) inherits from CPlayerInventory and provides TF2-specific loadout logic:
GetItemInLoadout( iClass, iSlot ) is the primary accessor used by CTFPlayer::GetLoadoutItem() to determine which weapon to give at spawn.
CEconItemView
CEconItemView is the in-memory representation of a single item instance. It holds the item definition index, item ID (64-bit), quality, level, and the attribute list:
Base items and fallback
If a player has no item equipped in a slot (or equips the base/stock item),LOADOUT_SLOT_USE_BASE_ITEM (value 0) signals that the class default weapon should be used. CTFPlayer::GiveDefaultItems() reads each slot and either grants the equipped item or the class default.
Wearable items
Cosmetic items areCTFWearable (game/shared/tf/tf_item_wearable.h) entities attached to the player model. On equip, the server spawns a wearable entity, parents it to the player, and applies the cosmetic model override. Wearables use MOVETYPE_FOLLOW to track the player bone attachment.
Item notifications and GC sync
On the client,CTFPlayerInventory::ItemHasBeenUpdated() fires when the GC delivers an updated item. The inventory manager (CEconItemInventoryManager) coordinates multiple player inventories and handles GC message callbacks for item grants, removals, and attribute changes.
Strange item tracking
Strange item tracking
Strange-quality items track kill/event counts via
CEconItemAttribute values updated server-side and periodically pushed to the GC. CTFGameStats records the events; CTFPlayer::Event_Killed() triggers the attribute increment.Killstreak items
Killstreak items
Killstreak kits add attributes that track the current killstreak count and apply sheen/killstreaker effects. The sheen is a VMT parameter overlay applied to the weapon material at runtime by the material proxy system.
Inventory data lives on Valve’s GC servers. The local game only holds a cached copy. During GC downtime, players fall back to their stock loadout.