]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/g_casings.qc
fix useless reference to fireball_impact.wav
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_casings.qc
1 float Casing_SendEntity(entity to, float sf)
2 {
3         WriteByte(MSG_ENTITY, ENT_CLIENT_CASING);
4         WriteByte(MSG_ENTITY, self.state); // actually type
5         WriteCoord(MSG_ENTITY, self.origin_x);
6         WriteCoord(MSG_ENTITY, self.origin_y);
7         WriteCoord(MSG_ENTITY, self.origin_z);
8         WriteShort(MSG_ENTITY, self.oldorigin_x); // acrually compressed velocity
9         WriteByte(MSG_ENTITY, self.angles_x * 256 / 360);
10         WriteByte(MSG_ENTITY, self.angles_y * 256 / 360);
11         WriteByte(MSG_ENTITY, self.angles_z * 256 / 360);
12         return TRUE;
13 }
14
15 void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, float casingtype, entity casingowner)
16 {
17         entity e;
18         vector org;
19
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;
21
22         if(!sound_allowed(MSG_BROADCAST, casingowner))
23                 casingtype |= 0x80;
24
25         e = spawn();
26         e.state = casingtype;
27         setorigin(e, org);
28         e.velocity = vel;
29         e.angles = ang;
30         e.oldorigin_x = compressShortVector(e.velocity);
31
32         Net_LinkEntity(e, TRUE, 0.2, Casing_SendEntity);
33                 // 0.2s should be enough time for all clients to receive this ent once, do the gibbage and be done with it
34 }