]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/state.qc
Stop server from requesting cvar values to the client on connection as it's no longer...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / state.qc
1 #include "state.qh"
2
3 void Inventory_new(PlayerState this);
4 void Inventory_delete(entity this);
5
6 void PlayerState_attach(entity this)
7 {
8         this._ps = NEW(PlayerState, this);
9
10         Inventory_new(PS(this));
11 }
12
13 void PlayerState_detach(entity this)
14 {
15     PlayerState ps = PS(this);
16         if (!ps) return;  // initial connect
17         PS(this) = NULL;
18
19         if (ps.m_client != this) return;  // don't own state, spectator
20         ps.ps_push(ps, this);
21     Inventory_delete(ps);
22
23         FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; });
24         delete(ps);
25 }
26
27 void GetCvars(entity this, entity store, int);
28 void DecodeLevelParms(entity this);
29 void PlayerScore_Attach(entity this);
30 void ClientData_Attach(entity this);
31 void accuracy_init(entity this);
32 void entcs_attach(entity this);
33 void anticheat_init(entity this);
34 void W_HitPlotOpen(entity this);
35 void bot_clientconnect(entity this);
36
37 void ClientState_attach(entity this)
38 {
39         this._cs = NEW(ClientState, this);
40
41         // TODO: fold all of these into ClientState
42
43         DecodeLevelParms(this);
44
45         PlayerScore_Attach(this);
46         PlayerStats_PlayerBasic_CheckUpdate(this);
47         ClientData_Attach(this);
48         accuracy_init(this);
49         entcs_attach(this);
50         anticheat_init(this);
51         W_HitPlotOpen(this);
52 }
53
54 void bot_clientdisconnect(entity this);
55 void W_HitPlotClose(entity this);
56 void anticheat_report_to_eventlog(entity this);
57 void entcs_detach(entity this);
58 void accuracy_free(entity this);
59 void ClientData_Detach(entity this);
60 void PlayerScore_Detach(entity this);
61
62 void ClientState_detach(entity this)
63 {
64     GetCvars(this, CS(this), -1);  // free cvars TODO: is this still needed now that it's stored on the clientstate entity?
65     accuracy_free(this); // TODO: needs to be before CS() is deleted!
66     PlayerScore_Detach(this); // what ^they^ said
67     W_HitPlotClose(this);
68     ClientData_Detach(this);
69     entcs_detach(this);
70         delete(CS(this));
71         this._cs = NULL;
72
73     bot_clientdisconnect(this);
74
75     anticheat_report_to_eventlog(this);
76 }