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

  1. /*========================================================================
  2.  
  3. Eject.qc - 8/14/96 Steve Bond (wedge)
  4.  
  5. ========================================================================*/
  6.  
  7. /*
  8. ===============
  9. eject_shell
  10.  
  11. Spews a spent shell casing from a shotgun
  12. ===============
  13. */
  14. void(vector org,vector dir) eject_shell =
  15. {
  16.         local float     flip;
  17.  
  18.         // Spawn one shell
  19.     newmis = spawn ();
  20.     newmis.owner = self;
  21.         newmis.movetype = MOVETYPE_BOUNCE;
  22.     newmis.solid = SOLID_BBOX;
  23.  
  24.     newmis.angles = vectoangles(dir);
  25.     
  26.     newmis.classname = "shellcasing";
  27.     newmis.think = SUB_Remove;
  28.         newmis.nextthink = time + 20;
  29.         setmodel (newmis, "shelcase.mdl");
  30.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);               
  31.     setorigin (newmis, org);
  32.  
  33.         // pick a random number
  34.         flip = random();
  35.         
  36.  
  37.         // Based on that number, pick a velocity
  38.         if (flip < 0.2 )
  39.         newmis.velocity = '75 20 150';
  40.  
  41.         else if (flip < 0.4)
  42.         newmis.velocity = '50 50 80';
  43.  
  44.         else if (flip < 0.6)
  45.         newmis.velocity = '10 25 200';
  46.  
  47.         else if (flip < 0.8)
  48.         newmis.velocity = '75 50 100';
  49.  
  50.         else
  51.         newmis.velocity = '40 10 75';
  52.  
  53.         // pick a random number
  54.         flip = random();
  55.  
  56.         // based on that rate, pick a rate at which to spin
  57.         if (flip < 0.25)
  58.         newmis.avelocity = '300 300 300';
  59.  
  60.         else if (flip < 0.5)
  61.         newmis.avelocity = '150 300 100';
  62.  
  63.         else if (flip < 0.75)
  64.         newmis.avelocity = '200 100 0';
  65.  
  66.         else
  67.         newmis.avelocity = '400 200 100';
  68. };
  69.  
  70.