]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/casings.qc
Adjusted the control panel to fit with the other option panels (height).
[divverent/nexuiz.git] / qcsrc / casings.qc
1 void CasingTouch (void)
2 {
3         self.angles_x = 0;
4         if (self.velocity == '0 0 0')
5                 self.avelocity = '0 0 0';
6 }
7
8 void CasingDamage (vector hitloc, float damage, entity inflictor, entity attacker, float deathtype)
9 {
10         self.flags = self.flags - (self.flags & FL_ONGROUND);
11         self.velocity = normalize (self.origin - hitloc) * damage * 3 + '0 0 100';
12         self.avelocity_x = random () * 500;
13         self.avelocity_y = random () * 500;
14         self.health = self.health - damage;
15         if (self.health <= 0)
16         SUB_VanishOrRemove(self);
17 }
18
19 void SpawnCasing (vector org, vector ang, vector vel, float ctype)
20 {
21         casing = spawn ();
22         casing.classname = "case";
23         casing.movetype = MOVETYPE_BOUNCE;
24         casing.solid = SOLID_CORPSE;
25         casing.touch = CasingTouch;
26
27         casing.effects = EF_LOWPRECISION;
28
29         setmodel (casing, "models/casing.mdl");
30         setorigin (casing, org);
31         setsize (casing, '-3 -3 -1', '3 3 1');
32
33         casing.health = 120;
34         casing.takedamage = DAMAGE_YES;
35         casing.damageforcescale = 5;
36         casing.velocity = vel;
37         casing.owner = self;
38         casing.angles = vectoangles (ang);
39         casing.avelocity_x = random () * 500;
40         casing.avelocity_y = random () * 500;
41
42         casing.event_damage = CasingDamage;
43
44         casing.skin = ctype;
45
46         SUB_SetFade (casing, time + 16 + random () * 4);
47 }