]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/state.qc
Merge branch 'master' into Mario/hagar_notfixed
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / state.qc
1 #include "state.qh"
2
3 void Inventory_new(entity 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(this);
11 }
12
13 void PlayerState_detach(entity this)
14 {
15         if (!PS(this)) return;  // initial connect
16         FOREACH_CLIENT(PS(it) == PS(this), { PS(it) = NULL; });
17         remove(PS(this));
18         this._ps = NULL;
19
20     Inventory_delete(self);
21 }
22
23 void GetCvars(entity this, int);
24 void DecodeLevelParms(entity this);
25 void PlayerScore_Attach(entity this);
26 void ClientData_Attach(entity this);
27 void accuracy_init(entity this);
28 void entcs_attach(entity this);
29 void playerdemo_init(entity this);
30 void anticheat_init(entity this);
31 void W_HitPlotOpen(entity this);
32 void bot_clientconnect(entity this);
33
34 void ClientState_attach(entity this)
35 {
36         this._cs = NEW(ClientState, this);
37
38     GetCvars(this, 0);  // get other cvars from player
39
40         // TODO: xonstat elo.txt support, until then just 404s
41         if (false && IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
42
43         // TODO: fold all of these into ClientState
44
45         DecodeLevelParms(this);
46
47         PlayerScore_Attach(this);
48         ClientData_Attach(this);
49         accuracy_init(this);
50         entcs_attach(this);
51         playerdemo_init(this);
52         anticheat_init(this);
53         W_HitPlotOpen(this);
54
55         bot_clientconnect(this);
56 }
57
58 void bot_clientdisconnect(entity this);
59 void W_HitPlotClose(entity this);
60 void anticheat_report(entity this);
61 void playerdemo_shutdown();
62 void entcs_detach(entity this);
63 void accuracy_free(entity this);
64 void ClientData_Detach(entity this);
65 void PlayerScore_Detach(entity this);
66
67 void ClientState_detach(entity this)
68 {
69         remove(CS(this));
70         this._cs = NULL;
71
72     GetCvars(this, -1);  // free cvars
73
74     bot_clientdisconnect(this);
75
76     W_HitPlotClose(this);
77     anticheat_report(this);
78     playerdemo_shutdown();
79     entcs_detach(this);
80     accuracy_free(self);
81     ClientData_Detach(this);
82     PlayerScore_Detach(self);
83 }