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

  1. void(float dmg) spawn_touchblood;
  2. void(entity targ,entity infl,entity atk,float dmg) T_Damage;
  3.  
  4. float WP_LASER = 8;
  5. float IM_LASER = 73;
  6.  
  7. void() LaserTouch = 
  8. {
  9.     if (other==self.owner)
  10.         return;
  11.     if (pointcontents(self.origin) == CONTENT_SKY)
  12.     {
  13.         remove(self);
  14.         return;
  15.     }
  16.     sound (self,CHAN_WEAPON,"enforcer/enfstop.wav",1,ATTN_NORM);
  17.     if (other.health)
  18.     {
  19.         spawn_touchblood(15);
  20.         T_Damage(other,self,self.owner,15);
  21.     }
  22.     else
  23.     {
  24.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  25.         WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  26.         WriteCoord (MSG_BROADCAST, self.origin_x);
  27.         WriteCoord (MSG_BROADCAST, self.origin_y);
  28.         WriteCoord (MSG_BROADCAST, self.origin_z);
  29.     }
  30.     remove(self);
  31. };
  32.  
  33. void() W_FireLaser = 
  34. {
  35.     local entity shot;
  36.  
  37.     if (self.currentammo<1)
  38.     {
  39.         self.weapon=W_BestWeapon();
  40.         self.ef=0;
  41.         W_SetCurrentAmmo();
  42.         return;
  43.     }
  44.     self.ammo_cells = self.ammo_cells - 4;
  45.     self.currentammo = floor(self.ammo_cells/4);
  46.     sound (self,CHAN_WEAPON,"enforcer/enfire.wav",1,ATTN_NORM);
  47.     shot=spawn();
  48.     shot.owner=self;
  49.     shot.movetype=MOVETYPE_FLY;
  50.     shot.solid=SOLID_BBOX;
  51.     shot.effects=EF_DIMLIGHT;
  52.     setmodel(shot,"progs/laser.mdl");
  53.     setsize(shot,'0 0 0','0 0 0');
  54.     setorigin(shot,self.origin+v_forward*8+'0 0 16');
  55.     shot.velocity=v_forward*1000;
  56.     shot.classname="laser";
  57.     shot.angles=vectoangles(shot.velocity);
  58.     shot.touch=LaserTouch;
  59.     shot.think=SUB_Remove;
  60.     shot.nextthink=time+6;
  61. };
  62.