]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc
OK weapons: Better secondary attack code.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / onslaught / sv_generator.qc
1 #include "sv_generator.qh"
2
3 bool generator_send(entity this, entity to, int sf)
4 {
5         WriteHeader(MSG_ENTITY, ENT_CLIENT_GENERATOR);
6         WriteByte(MSG_ENTITY, sf);
7         if(sf & GSF_SETUP)
8         {
9                 WriteCoord(MSG_ENTITY, this.origin_x);
10                 WriteCoord(MSG_ENTITY, this.origin_y);
11                 WriteCoord(MSG_ENTITY, this.origin_z);
12
13                 WriteByte(MSG_ENTITY, this.health);
14                 WriteByte(MSG_ENTITY, this.max_health);
15                 WriteByte(MSG_ENTITY, this.count);
16                 WriteByte(MSG_ENTITY, this.team);
17         }
18
19         if(sf & GSF_STATUS)
20         {
21                 WriteByte(MSG_ENTITY, this.team);
22
23                 if(this.health <= 0)
24                         WriteByte(MSG_ENTITY, 0);
25                 else
26                         WriteByte(MSG_ENTITY, ceil((this.health / this.max_health) * 255));
27         }
28
29         return true;
30 }