]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/generator.qc
Merge branch 'master' into Mario/ons_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / generator.qc
1 float generator_send(entity to, float sf)
2 {
3         WriteByte(MSG_ENTITY, ENT_CLIENT_GENERATOR);
4         WriteByte(MSG_ENTITY, sf);
5         if(sf & GSF_SETUP)
6         {
7                 WriteCoord(MSG_ENTITY, self.origin_x);
8                 WriteCoord(MSG_ENTITY, self.origin_y);
9                 WriteCoord(MSG_ENTITY, self.origin_z);
10
11                 WriteByte(MSG_ENTITY, self.health);
12                 WriteByte(MSG_ENTITY, self.max_health);
13                 WriteByte(MSG_ENTITY, self.count);
14                 WriteByte(MSG_ENTITY, self.team);
15         }
16
17         if(sf & GSF_STATUS)
18         {
19                 WriteByte(MSG_ENTITY, self.team);
20
21                 if(self.health <= 0)
22                         WriteByte(MSG_ENTITY, 0);
23                 else
24                         WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255));
25         }
26
27         return TRUE;
28 }
29
30 void generator_link(void() spawnproc)
31 {
32         Net_LinkEntity(self, TRUE, 0, generator_send);
33         self.think              = spawnproc;
34         self.nextthink  = time;
35 }