home *** CD-ROM | disk | FTP | other *** search
/ Quaker's Paradise / Quakers_Paradise.iso / div / cooppak / source / flame.qc < prev    next >
Encoding:
Text File  |  1997-06-20  |  5.9 KB  |  218 lines

  1. /*
  2. ============================================================================
  3.  
  4. Quake Flamethrower 1.0
  5.  
  6. Another groovy patch from Quake Command - http://www.nuc.net/quake
  7.  
  8. QC Code By : Steve Bond         wedge@nuc.net
  9.  
  10. Apologies in advance... I was unable to comment this as well as I'd have
  11. liked to. (I used some weird variable names - hope they don't cause problems.
  12.  
  13. ============================================================================
  14. */
  15.  
  16. // Internal declaration
  17.         void (vector fireorg) SpawnTouchFlame;
  18.         void () BurnThem;
  19.  
  20. // Player.qc declaration
  21.         void () DeathBubblesSpawn;
  22.  
  23.  
  24.  
  25. // Slightly varied version of DEATHBUBBLES
  26. void(float num_bubbles, vector bub_origin) NewBubbles =
  27. {
  28. local entity    bubble_spawner;
  29.     
  30.     bubble_spawner = spawn();
  31.         setorigin (bubble_spawner, bub_origin);
  32.     bubble_spawner.movetype = MOVETYPE_NONE;
  33.     bubble_spawner.solid = SOLID_NOT;
  34.     bubble_spawner.nextthink = time + 0.1;
  35.  
  36.         if (self.classname == "player")
  37.                 bubble_spawner.owner = self;
  38.         else
  39.                 bubble_spawner.owner = self.firewood;
  40.  
  41.         bubble_spawner.think = DeathBubblesSpawn;
  42.     bubble_spawner.bubble_count = num_bubbles;
  43.     return;
  44. };
  45.  
  46.  
  47. /*
  48. ===============
  49. BurnSelf 
  50. ===============
  51. */
  52. void () BurnSelf =
  53. {
  54.         local entity    flame;
  55.  
  56.         flame = spawn ();
  57.         flame.owner = self;
  58.         flame.movetype = MOVETYPE_FLYMISSILE;
  59.         flame.velocity = '0 0 75';
  60.         flame.solid = SOLID_NOT;
  61.         flame.classname = "fire";
  62.         flame.origin = self.origin;
  63.         self.onfire = TRUE;
  64.         flame.firewood = self;
  65.         flame.think = BurnThem;
  66.         flame.nextthink = time;
  67.         setmodel (flame, "progs/s_explod.spr");
  68.         setsize (flame, '0 0 0', '0 0 0');            
  69. };
  70.  
  71. /*
  72. ===============
  73. Burn Them!
  74. ===============
  75. */
  76. void () BurnThem =
  77. {
  78.         // CHECK FOR WATER *FIRST*
  79.         if (self.firewood.waterlevel >= 1)
  80.         {
  81.                 NewBubbles(6,self.firewood.origin);
  82.                 self.firewood.onfire = FALSE;
  83.                 self.firewood.effects = self.firewood.effects - EF_DIMLIGHT;
  84.                 remove(self);
  85.                 return;
  86.         }
  87.         else if (self.firewood.health > 0)
  88.         {
  89.                 SpawnTouchFlame(self.firewood.origin);
  90.                 T_Damage (self.firewood, self, self.owner, 1);
  91.                 self.nextthink = time + 0.25;
  92.         }
  93.         else if (self.firewood.health <= 0)
  94.                 self.firewood.effects = self.firewood.effects - EF_DIMLIGHT;
  95. };
  96.  
  97.  
  98. /*
  99. ================
  100. SpawnTouchFlame
  101. ================
  102. */
  103.  
  104. void (vector fireorg) SpawnTouchFlame =
  105. {
  106.         local entity    flame;
  107.         local   float   rn;
  108.  
  109.         flame = spawn ();
  110.         flame.owner = self;
  111.         flame.movetype = MOVETYPE_FLYMISSILE;
  112.         flame.velocity = '0 0 75';
  113.         flame.solid = SOLID_NOT;
  114.         flame.classname = "fire";
  115.         flame.origin = fireorg;
  116.         flame.think = s_explode1;
  117.         flame.nextthink = time;
  118.         setmodel (flame, "progs/s_explod.spr");
  119.         setsize (flame, '0 0 0', '0 0 0');            
  120. };
  121.  
  122. /*
  123. ================
  124. FlameTouch
  125. ================
  126. */
  127. void () FlameTouch =
  128. {
  129.         local   float   rn;
  130.  
  131.         if (other == self.owner)
  132.                 return;
  133.  
  134.         if (other.takedamage)
  135.         {
  136.                 rn = random();
  137.                 // 20% chance
  138.                 if (rn <= 0.2 && !other.onfire)
  139.                 {
  140.                         // Fire stays with whatever it hits
  141.                         if (other.classname == "player")
  142.                         {
  143.                                 centerprint(other,"You are on fire! Find WATER!\n");
  144.                                 stuffcmd (other,"bf\n");
  145.                         }
  146.                         other.onfire = TRUE;
  147.                         self.firewood = other;
  148.                         self.think = BurnThem;
  149.                         self.nextthink = time;
  150.                         self.solid = SOLID_NOT;
  151.                         setmodel (self,"");
  152.                         other.effects = other.effects | EF_DIMLIGHT;
  153.                 }
  154.                 else
  155.                 {
  156.                         SpawnTouchFlame(other.origin);
  157.                         T_Damage (other, self, self.owner, 10 );
  158.                         remove (self);
  159.                 }
  160.         }
  161.         else if (other.classname == "worldspawn")
  162.         {
  163.                 self.velocity = '0 0 0';
  164.         }
  165. };
  166.  
  167. /*
  168. ================
  169. W_FireFlame
  170. ================
  171. */
  172. void() W_FireFlame =
  173. {
  174.         local   entity flame;
  175.         local   float rn;
  176.  
  177.         if (self.waterlevel > 2)
  178.         {
  179.                 makevectors (self.v_angle);
  180.                 NewBubbles(2, self.origin+v_forward*64);
  181.  
  182.                 rn = random();
  183.                 if (rn < 0.5)
  184.                         sound (self, CHAN_WEAPON, "misc/water1.wav", 1, ATTN_NORM);
  185.                 else
  186.                         sound (self, CHAN_WEAPON, "misc/water2.wav", 1, ATTN_NORM);
  187.  
  188.                 return;
  189.         }
  190.  
  191.         // Take away a shell
  192.         self.currentammo = self.ammo_shells = self.ammo_shells - 1;
  193.  
  194.         sound (self, CHAN_WEAPON, "hknight/hit.wav", 1, ATTN_NORM);
  195.  
  196.         flame = spawn ();
  197.         flame.owner = self;
  198.         flame.movetype = MOVETYPE_FLYMISSILE;
  199.         flame.solid = SOLID_BBOX;
  200.         flame.classname = "fire";
  201.         
  202. // set flame speed    
  203.  
  204.     makevectors (self.v_angle);
  205.  
  206.                 flame.velocity = aim(self, 10000);
  207.                 flame.velocity = flame.velocity * 300;
  208.  
  209.         flame.touch = FlameTouch;
  210.     
  211.         flame.think = s_explode1;
  212.         flame.nextthink = time + 0.15;
  213.  
  214.         setmodel (flame, "progs/s_explod.spr");
  215.         setsize (flame, '0 0 0', '0 0 0');            
  216.         setorigin (flame, self.origin + v_forward * 16 + '0 0 16');
  217. };
  218.