home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / qwiz12 / light.qc < prev    next >
Encoding:
Text File  |  1996-08-16  |  2.5 KB  |  117 lines

  1. //--------------------------------------------------------------------
  2. // Light Spell
  3. //--------------------------------------------------------------------
  4.  
  5.  
  6. void() light_touch =
  7. {
  8. local float rand;
  9.  
  10.         sound (self, CHAN_WEAPON, "player/tornoff2.wav", 1, ATTN_NORM);    
  11.  
  12.     if (other == self.owner)
  13.         return;
  14.  
  15.         if (other.classname == "door" || other.classname == "plat")
  16.                 {
  17.                 remove(self);
  18.                 return;
  19.                 }
  20.  
  21.     if (other.solid == SOLID_TRIGGER)
  22.         return; // trigger field, do nothing
  23.  
  24.     if (pointcontents(self.origin) == CONTENT_SKY)
  25.     {
  26.         remove(self);
  27.         return;
  28.     }
  29.     
  30. // hit something that bleeds
  31.     if (other.takedamage)
  32.     {
  33.  
  34.         self.origin = other.origin + '0 0 0';
  35.         return;
  36.     }
  37.     else
  38.     {
  39.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  40.             WriteByte (MSG_BROADCAST, TE_SPIKE);
  41.         WriteCoord (MSG_BROADCAST, self.origin_x);
  42.         WriteCoord (MSG_BROADCAST, self.origin_y);
  43.         WriteCoord (MSG_BROADCAST, self.origin_z);
  44.  }
  45.  
  46.     self.movetype = MOVETYPE_NONE;
  47.  
  48.         self.origin = self.origin - self.velocity * 0.0001;
  49.          self.velocity = '0 0 0';
  50.     self.touch = SUB_Null;
  51. };
  52.  
  53.  
  54.  
  55. void (vector org, vector dir) launch_light =
  56. {
  57.         local   entity  missile;
  58.  
  59.     missile = spawn ();
  60.     missile.owner = self;
  61.     missile.movetype = MOVETYPE_FLYMISSILE;
  62.     missile.solid = SOLID_BBOX;
  63.  
  64.     missile.angles = vectoangles(dir);
  65.  
  66.     missile.touch = light_touch;
  67.         missile.classname = "light";
  68.  
  69. // remove light
  70.     missile.think = SUB_Remove;
  71. // keep light alive        
  72.         missile.nextthink = time + 10;
  73.  
  74.     setmodel (missile, "progs/s_bubble.spr");
  75.     setsize (missile, VEC_ORIGIN, VEC_ORIGIN);               
  76.     setorigin (missile, org);
  77.     missile.velocity = dir * 1000;
  78.         missile.effects=EF_DIMLIGHT;
  79. };
  80.  
  81.  
  82.  
  83.  
  84. void(float ox) W_FireLight =
  85. {
  86.     local vector    dir;
  87.     local entity    old;
  88.     
  89.     makevectors (self.v_angle);
  90.  
  91.     self.attack_finished = time + 0.5;
  92.     dir = aim (self, 1000);
  93.         launch_light (self.origin + '0 0 20' + v_right*ox, dir);
  94.  
  95.     self.punchangle_x = -2;
  96. };
  97.  
  98.  
  99.  
  100.  
  101. //--------------------------------------------------------------------
  102. // Checks if Light can be fired
  103. //--------------------------------------------------------------------
  104. void() LightC = 
  105. {
  106.     if (self.ammo_cells < 10)
  107.     {
  108.         sprint(self,"cells are low\n");
  109.         return;
  110.     }
  111.       self.currentammo = self.ammo_cells = self.ammo_cells - 10;
  112.     W_SetCurrentAmmo();
  113.  
  114.     sound (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM);
  115.     W_FireLight ();
  116. };
  117.