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

  1. void() GrenadeExplode;
  2. void() GrenadeTouch;
  3. void() BecomeExplosion;
  4. float() crandom;
  5.  
  6. float WP_CLUSTER = 1;
  7. float IM_CLUSTER = 70;
  8.  
  9. void() BabyExplode =
  10. {
  11.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  12.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  13.     WriteCoord (MSG_BROADCAST, self.origin_x);
  14.     WriteCoord (MSG_BROADCAST, self.origin_y);
  15.     WriteCoord (MSG_BROADCAST, self.origin_z);
  16.     
  17.     T_NewRadiusDamage(self,self.owner,50,world,160);
  18.     BecomeExplosion();
  19. };
  20.  
  21. void() BabyTouch =
  22. {
  23.     if (other==self.owner)
  24.         return;
  25.     if (other.takedamage == DAMAGE_AIM)
  26.     {
  27.         BabyExplode();
  28.         return;
  29.     }
  30.     sound (self,CHAN_WEAPON,"weapons/bounce.wav",1,ATTN_NORM);
  31.     if (self.velocity=='0 0 0')
  32.         self.avelocity='0 0 0';
  33. };
  34.  
  35. void() ClusterExplode = 
  36. {
  37.     local entity missile;
  38.     local float tmp;
  39.     
  40.     WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  41.     WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  42.     WriteCoord (MSG_BROADCAST, self.origin_x);
  43.     WriteCoord (MSG_BROADCAST, self.origin_y);
  44.     WriteCoord (MSG_BROADCAST, self.origin_z);
  45.     
  46.     tmp =0;
  47.     while (tmp <5)
  48.     {
  49.         missile=spawn();
  50.         missile.owner = self.owner;
  51.         missile.movetype = MOVETYPE_BOUNCE;
  52.         missile.solid = SOLID_BBOX;
  53.         missile.classname = "grenade";
  54.         missile.think = BabyExplode;
  55.         missile.nextthink = time+1.5;
  56.         missile.velocity_z=500;
  57.         missile.velocity_x=400*random() - 200;
  58.         missile.velocity_y=400*random() - 200;
  59.         missile.avelocity= '300 300 300';
  60.         missile.angles=vectoangles(missile.velocity);
  61.         missile.touch=BabyTouch;
  62.         setmodel(missile,"progs/grenade.mdl");
  63.         setsize(missile,'0 0 0','0 0 0');
  64.         setorigin(missile,self.origin);
  65.         tmp=tmp+1;
  66.     }
  67.     BecomeExplosion();
  68. };
  69.     
  70. void() ClusterTouch =
  71. {
  72.     if (other == self.owner)
  73.         return;
  74.     if (other.takedamage == DAMAGE_AIM)
  75.     {
  76.         ClusterExplode();
  77.         return;
  78.     }
  79.     sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
  80.     if (self.velocity == '0 0 0')
  81.         self.avelocity = '0 0 0';
  82. };
  83.  
  84. void() W_FireCluster =
  85. {
  86.     local entity missile;
  87.     if (self.currentammo<1)
  88.     {
  89.         self.weapon=W_BestWeapon();
  90.         W_SetCurrentAmmo();
  91.         self.ef=0;
  92.         return;
  93.     }
  94.     self.ammo_rockets = self.ammo_rockets - 10;
  95.     self.currentammo=floor(self.ammo_rockets/10);
  96.     sound (self,CHAN_WEAPON,"weapons/grenade.wav", 1, ATTN_NORM);
  97.     self.punchangle_x= -2;
  98.     missile=spawn();
  99.     missile.owner=self;
  100.     missile.movetype=MOVETYPE_BOUNCE;
  101.     missile.solid=SOLID_BBOX;
  102.     missile.classname="clusterbomb";
  103.     makevectors(self.v_angle);
  104.     if(self.v_angle_x)
  105.         missile.velocity=v_forward*600+v_up*200+crandom()*v_right*10+crandom()*v_up*10;
  106.     else
  107.     {
  108.         missile.velocity = aim(self,10000);
  109.         missile.velocity=missile.velocity*600;
  110.         missile.velocity_z=200;
  111.     }
  112.     missile.avelocity='300 300 300';
  113.     missile.angles=vectoangles(missile.velocity);
  114.     missile.touch=ClusterTouch;
  115.     missile.nextthink=time+1.5;
  116.     missile.think=ClusterExplode;
  117.     setmodel(missile,"progs/grenade.mdl");
  118.     setsize(missile,'0 0 0','0 0 0');
  119.     setorigin(missile,self.origin);
  120. };
  121.