]> de.git.xonotic.org Git - voretournament/voretournament.git/blob - data/qcsrc/server/g_casings.qc
eater -> predator, because that's a more correct word
[voretournament/voretournament.git] / data / qcsrc / server / g_casings.qc
1 float Casing_SendEntity(entity to, float sf)\r
2 {\r
3         WriteByte(MSG_ENTITY, ENT_CLIENT_CASING);\r
4         WriteByte(MSG_ENTITY, self.state); // actually type\r
5         WriteCoord(MSG_ENTITY, self.origin_x);\r
6         WriteCoord(MSG_ENTITY, self.origin_y);\r
7         WriteCoord(MSG_ENTITY, self.origin_z);\r
8         WriteShort(MSG_ENTITY, self.oldorigin_x); // acrually compressed velocity\r
9         WriteByte(MSG_ENTITY, self.angles_x * 256 / 360);\r
10         WriteByte(MSG_ENTITY, self.angles_y * 256 / 360);\r
11         WriteByte(MSG_ENTITY, self.angles_z * 256 / 360);\r
12         return TRUE;\r
13 }\r
14 \r
15 void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, float casingtype, entity casingowner)\r
16 {\r
17         entity e;\r
18         vector org;\r
19 \r
20         org = self.origin + self.view_ofs + self.weaponentity.spawnorigin_x * v_forward - self.weaponentity.spawnorigin_y * v_right + self.weaponentity.spawnorigin_z * v_up;\r
21 \r
22         if(!sound_allowed(MSG_BROADCAST, casingowner))\r
23                 casingtype |= 0x80;\r
24 \r
25         e = spawn();\r
26         e.state = casingtype;\r
27         setorigin(e, org);\r
28         e.velocity = vel;\r
29         e.angles = ang;\r
30         e.oldorigin_x = compressShortVector(e.velocity);\r
31 \r
32         Net_LinkEntity(e, TRUE, 0.2, Casing_SendEntity);\r
33                 // 0.2s should be enough time for all clients to receive this ent once, do the gibbage and be done with it\r
34 }\r