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

  1. void() Laser_Touch_P =
  2. {
  3.     local vector org;
  4.     
  5.     if (other == self.owner)
  6.         return;        // don't explode on owner
  7.  
  8.     if (pointcontents(self.origin) == CONTENT_SKY)
  9.     {
  10.         remove(self);
  11.         return;
  12.     }
  13.     
  14.     org = self.origin - 8*normalize(self.velocity);
  15.  
  16.     if (other.health)
  17.     {
  18.         SpawnBlood (org, self.velocity*0.2, 15);
  19.         T_Damage (other, self, self.owner, 15);
  20.     }
  21.     else
  22.     {
  23.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  24.                 WriteByte (MSG_BROADCAST,  TE_KNIGHTSPIKE);
  25.         WriteCoord (MSG_BROADCAST, org_x);
  26.         WriteCoord (MSG_BROADCAST, org_y);
  27.         WriteCoord (MSG_BROADCAST, org_z);
  28.     }
  29.     remove(self);    
  30. };
  31.  
  32. void(vector org, vector dir) Launch_Laser =
  33. {
  34.         sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
  35.     newmis = spawn();
  36.     newmis.owner = self;
  37.         newmis.movetype = MOVETYPE_FLYMISSILE;
  38.         newmis.solid = SOLID_BBOX;
  39.     newmis.effects = EF_DIMLIGHT;
  40.         newmis.velocity = dir * 1800;
  41.     newmis.angles = vectoangles(newmis.velocity);
  42.         newmis.touch = Laser_Touch_P;
  43.         newmis.nextthink = time + 6;
  44.     newmis.think = SUB_Remove;
  45.     setmodel (newmis, "progs/laser.mdl");
  46.     setsize (newmis, '0 0 0', '0 0 0');        
  47.         setorigin (newmis, org);
  48. };
  49.