home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / sgqcver2 / flare.qc < prev    next >
Encoding:
Text File  |  1996-08-22  |  2.1 KB  |  86 lines

  1. void() flare_touch =
  2. {
  3. local float rand;
  4.     if (other == self.owner)
  5.         return;
  6.  
  7.         if (other.classname == "door" || other.classname == "plat")
  8.                 {
  9.                 remove(self);
  10.                 return;
  11.                 }
  12.  
  13.     if (other.solid == SOLID_TRIGGER)
  14.         return; // trigger field, do nothing
  15.  
  16.     if (pointcontents(self.origin) == CONTENT_SKY)
  17.     {
  18.         remove(self);
  19.         return;
  20.     }
  21.     
  22.     if (other.takedamage)
  23.     {
  24.         spawn_touchblood (9);
  25.         T_Damage (other, self, self.owner, 1);
  26.  
  27.           if (self.velocity != '0 0 0')
  28.             remove(self);
  29.     }
  30.     else
  31.     {
  32.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  33.         WriteByte (MSG_BROADCAST, TE_SPIKE);
  34.         WriteCoord (MSG_BROADCAST, self.origin_x);
  35.         WriteCoord (MSG_BROADCAST, self.origin_y);
  36.         WriteCoord (MSG_BROADCAST, self.origin_z);
  37.     }
  38.     self.movetype = MOVETYPE_NONE;
  39.         self.origin = self.origin - self.velocity * 0.005;
  40.          self.velocity = '0 0 0';
  41.     self.touch = SUB_Null;
  42. };
  43.  
  44. void() flare_dim =
  45. {
  46.         self.effects=EF_DIMLIGHT;
  47.     self.nextthink = time + 15;
  48.     self.think = SUB_Remove;
  49. };
  50.  
  51. void() flare_bright =
  52. {
  53.     local vector    vel;
  54.         self.effects=EF_BRIGHTLIGHT;
  55.     self.nextthink = time + 10;
  56.     self.think = flare_dim;
  57.     sound (self, CHAN_WEAPON, "misc/power.wav", 1, ATTN_NORM);
  58.     vel = '0 0 150';
  59.     particle (self.origin+vel*0.01,vel,111,150);
  60.         vel = '0 0 120';
  61.     particle (self.origin+vel*0.01,vel,73,200);
  62. };
  63.  
  64. void(vector org, vector dir) launch_flare =
  65. {
  66.     local   entity  missile;
  67.  
  68.     missile = spawn ();
  69.     missile.owner = self;
  70.     missile.movetype = MOVETYPE_FLYMISSILE;
  71.         missile.classname = "flare";
  72.         missile.health = 3;
  73.         missile.takedamage = DAMAGE_AIM;
  74.         missile.th_die = SUB_Remove;
  75.     missile.solid = SOLID_BBOX;
  76.     missile.angles = vectoangles(dir);
  77.     missile.touch = flare_touch;
  78.     missile.think = flare_bright;
  79.     missile.nextthink = time + 3;
  80.     setmodel (missile, "progs/laser.mdl");
  81.         setsize (missile, VEC_ORIGIN, VEC_ORIGIN);               
  82.     setorigin (missile, org);
  83.     missile.velocity = dir * 1000;
  84.         missile.effects=EF_DIMLIGHT;
  85. };
  86.