3 #include <common/mutators/mutator/status_effects/_mod.qh>
4 #include <server/command/getreplies.qh>
6 void Inventory_new(PlayerState this);
7 void Inventory_delete(entity this);
8 void Inventory_clear(PlayerState this);
9 void InventoryStorage_attach(PlayerState this);
10 void InventoryStorage_delete(PlayerState this);
12 void PlayerState_attach(entity this)
14 if (PS(this) && PS(this).m_client == this)
17 this._ps = NEW(PlayerState, this);
19 Inventory_new(PS(this));
22 void PlayerState_detach(entity this)
24 PlayerState ps = PS(this);
25 if (!ps) return; // initial connect
27 Inventory_clear(this.inventory_store); // no need to network updates, as there is no inventory attached
29 if (ps.m_client != this) return; // don't own state, spectator
33 FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; });
37 void DecodeLevelParms(entity this);
38 void PlayerScore_Attach(entity this);
39 void ClientData_Attach(entity this);
40 void accuracy_init(entity this);
41 void entcs_attach(entity this);
42 void anticheat_init(entity this);
43 void W_HitPlotOpen(entity this);
44 void bot_clientconnect(entity this);
46 void ClientState_attach(entity this)
48 this._cs = NEW(ClientState, this);
50 // TODO: fold all of these into ClientState
52 DecodeLevelParms(this);
54 PlayerScore_Attach(this);
55 PlayerStats_PlayerBasic_CheckUpdate(this);
56 ClientData_Attach(this);
61 InventoryStorage_attach(this);
62 StatusEffectsStorage_attach(this);
65 void bot_clientdisconnect(entity this);
66 void W_HitPlotClose(entity this);
67 void anticheat_report_to_eventlog(entity this);
68 void entcs_detach(entity this);
69 void accuracy_free(entity this);
70 void ClientData_Detach(entity this);
71 void PlayerScore_Detach(entity this);
73 void ClientState_detach(entity this)
75 GetCvars(this, CS_CVAR(this), -1); // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
76 accuracy_free(this); // TODO: needs to be before CS() is deleted!
77 PlayerScore_Detach(this); // what ^they^ said
79 ClientData_Detach(this);
81 InventoryStorage_delete(this);
82 StatusEffectsStorage_delete(this);
86 bot_clientdisconnect(this);
88 anticheat_report_to_eventlog(this);