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

  1. float IM_LIGHTROCK = 76;
  2. float WP_LIGHTROCK = 32;
  3.  
  4. void() LightRockExplode =
  5. {
  6.     T_RadiusDamage(self,self.owner,30,world);
  7.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  8.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  9.     WriteCoord (MSG_BROADCAST, self.origin_x);
  10.     WriteCoord (MSG_BROADCAST, self.origin_y);
  11.     WriteCoord (MSG_BROADCAST, self.origin_z);
  12.  
  13.     BecomeExplosion ();
  14. };
  15.  
  16. void() LightRockTouch =
  17. {
  18.     LightRockExplode();
  19. };
  20.  
  21. void() LightRockThink = // has important parts of VHOLD's, with slight mods
  22. {
  23.     local entity head,selected;
  24.   head = findradius(self.origin, 250);
  25.      if (self.t_width<time)
  26.      {
  27.          sound(self,CHAN_WEAPON,"weapons/lhit.wav",1,ATTN_NORM);
  28.          self.t_width=time+0.6;
  29.      }    
  30.   while(head)
  31.   {
  32.         if( (head.health > 1) && (head != self) && (head != self.owner) && (head.classname != "door") && (head.classname != "misc_explobox") && !(head.items & IT_INVISIBILITY) )
  33.         {
  34.         traceline(self.origin,head.origin,TRUE,self);
  35.         if ( (trace_fraction >= 1) )
  36.         {
  37.           selected = head;
  38.           if (head!=world)
  39.           {
  40.                         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  41.                         WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
  42.                         WriteEntity (MSG_BROADCAST, self);
  43.                         WriteCoord (MSG_BROADCAST, self.origin_x);
  44.                         WriteCoord (MSG_BROADCAST, self.origin_y);
  45.                         WriteCoord (MSG_BROADCAST, self.origin_z);
  46.                         WriteCoord (MSG_BROADCAST, head.origin_x);
  47.                         WriteCoord (MSG_BROADCAST, head.origin_y);
  48.                         WriteCoord (MSG_BROADCAST, head.origin_z);
  49.                         if (pointcontents(head.origin)==CONTENT_WATER)
  50.                             T_Damage(head,self,self.owner,400); // BIIIIG ZAP
  51.                         else
  52.                             T_Damage(head,self,self.owner,20);
  53.                     }
  54.         }
  55.       }
  56.     head = head.chain;
  57.   } 
  58.     if (pointcontents(self.origin)==CONTENT_WATER)     // Oh man this one hurts
  59.     {
  60.         T_NewRadiusDamage(self,self.owner,400,world,400);
  61.         LightRockExplode();
  62.     }
  63.     self.nextthink=time+0.1;
  64. };
  65.  
  66. void() W_FireLightRocket =
  67. {
  68.     local entity missile;
  69.     local float temp;
  70.     
  71.     if (self.currentammo<1)
  72.     {
  73.         self.weapon=W_BestWeapon();
  74.         self.ef=0;
  75.         W_SetCurrentAmmo();
  76.         return;
  77.     }
  78.     self.ammo_rockets=self.ammo_rockets - 1;
  79.     self.ammo_cells=self.ammo_cells - 40;
  80.     temp = floor(self.ammo_cells/40);
  81.     self.currentammo=min(self.ammo_rockets,temp);
  82.     sound(self,CHAN_WEAPON,"weapons/sgun1.wav",1,ATTN_NORM);
  83.     self.punchangle_x= -2;
  84.     missile=spawn();
  85.     missile.owner=self;
  86.     missile.movetype=MOVETYPE_FLYMISSILE;
  87.     missile.solid=SOLID_BBOX;
  88.     makevectors(self.v_angle);
  89.     missile.velocity=aim(self,250);
  90.     missile.velocity=missile.velocity*250;
  91.     missile.angles=vectoangles(missile.velocity);
  92.     missile.touch=LightRockTouch;
  93.     missile.nextthink=time+0.5;
  94.     missile.t_width=time+0.6;
  95.     missile.think=LightRockThink;
  96.     setmodel(missile,"progs/missile.mdl");
  97.     setsize(missile,'0 0 0','0 0 0');
  98.     setorigin(missile,self.origin+v_forward*8+'0 0 16');
  99. };