]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/elimination.qc
Purge autocvars.qh from the codebase, cvars are defined in the headers of the feature...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / elimination.qc
1 #include "elimination.qh"
2
3 #include <common/net_linked.qh>
4 #include <server/utils.qh>
5
6 .float(entity) isEliminated;
7 bool EliminatedPlayers_SendEntity(entity this, entity to, float sendflags)
8 {
9         Stream out = MSG_ENTITY;
10         WriteHeader(out, ENT_CLIENT_ELIMINATEDPLAYERS);
11         serialize(byte, out, sendflags);
12         if (sendflags & 1) {
13                 for (int i = 1; i <= maxclients; i += 8) {
14                         int f = 0;
15                         entity e = edict_num(i);
16                         for (int b = 0; b < 8; ++b, e = nextent(e)) {
17                                 if (eliminatedPlayers.isEliminated(e)) {
18                                         f |= BIT(b);
19                                 }
20                         }
21                         serialize(byte, out, f);
22                 }
23         }
24         return true;
25 }
26
27 void EliminatedPlayers_Init(float(entity) isEliminated_func)
28 {
29         if(eliminatedPlayers)
30         {
31                 backtrace("Can't spawn eliminatedPlayers again!");
32                 return;
33         }
34         Net_LinkEntity(eliminatedPlayers = spawn(), false, 0, EliminatedPlayers_SendEntity);
35         eliminatedPlayers.isEliminated = isEliminated_func;
36 }