lava_wpn.qc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /* Copyright (C) 1996-2022 id Software LLC
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  13. See file, 'COPYING', for details.
  14. */
  15. // LAVA Weapon Routines
  16. /*
  17. ===============
  18. launch_lava_spike
  19. Used for both the player and the ogre
  20. ===============
  21. */
  22. void(vector org, vector dir) launch_lava_spike =
  23. {
  24. newmis = spawn ();
  25. newmis.owner = self;
  26. newmis.movetype = MOVETYPE_FLYMISSILE;
  27. newmis.solid = SOLID_BBOX;
  28. newmis.angles = vectoangles(dir);
  29. newmis.touch = lavaspike_touch;
  30. newmis.classname = "lava_spike";
  31. newmis.think = SUB_Remove;
  32. newmis.nextthink = time + 6;
  33. setmodel (newmis, "progs/lspike.mdl");
  34. setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
  35. setorigin (newmis, org);
  36. newmis.velocity = dir * 1000;
  37. };
  38. void() W_FireSuperLavaSpikes =
  39. {
  40. local vector dir;
  41. local entity old;
  42. sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
  43. self.attack_finished = time + 0.2;
  44. self.currentammo = self.ammo_lava_nails = self.ammo_lava_nails - 2;
  45. UpdateAmmoCounts (self);
  46. dir = aim (self, 1000);
  47. launch_lava_spike (self.origin + '0 0 16', dir);
  48. newmis.touch = superlavaspike_touch;
  49. // setmodel (newmis, "progs/lspike.mdl");
  50. setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
  51. self.punchangle_x = -2;
  52. };
  53. void(float ox) W_FireLavaSpikes =
  54. {
  55. local vector dir;
  56. local entity old;
  57. makevectors (self.v_angle);
  58. if (self.ammo_lava_nails >= 2 && self.weapon == IT_LAVA_SUPER_NAILGUN)
  59. {
  60. W_FireSuperLavaSpikes ();
  61. return;
  62. }
  63. if (self.ammo_lava_nails < 1)
  64. {
  65. sprint (self, "$qc_out_lava_nails");
  66. self.weapon = W_BestWeapon ();
  67. W_SetCurrentAmmo ();
  68. return;
  69. }
  70. sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
  71. self.attack_finished = time + 0.2;
  72. self.currentammo = self.ammo_lava_nails = self.ammo_lava_nails - 1;
  73. UpdateAmmoCounts (self);
  74. dir = aim (self, 1000);
  75. launch_lava_spike (self.origin + '0 0 16' + v_right*ox, dir);
  76. self.punchangle_x = -2;
  77. };
  78. // =============== Lava Spike Touch Routines
  79. void() lavaspike_touch =
  80. {
  81. local float rand;
  82. local float old_armortype;
  83. local float old_armorvalue;
  84. local float old_armormask;
  85. if (other == self.owner)
  86. return;
  87. if (other.solid == SOLID_TRIGGER)
  88. return; // trigger field, do nothing
  89. if (pointcontents(self.origin) == CONTENT_SKY)
  90. {
  91. remove(self);
  92. return;
  93. }
  94. // hit something that bleeds
  95. if (other.takedamage)
  96. {
  97. spawn_touchblood (9);
  98. if(other.classname == "player")
  99. {
  100. old_armortype = other.armortype;
  101. old_armorvalue = other.armorvalue;
  102. old_armormask = other.items2 & (IT2_ARMOR1|IT2_ARMOR2|IT2_ARMOR3);
  103. other.armortype = 0;
  104. other.armorvalue = 0;
  105. T_Damage (other, self, self.owner, 9);
  106. other.armortype = old_armortype;
  107. other.armorvalue = old_armorvalue;
  108. other.items2 = other.items2 | old_armormask;
  109. }
  110. else // is a monster
  111. {
  112. if ( other.classname != "monster_lava_man")
  113. {
  114. T_Damage (other, self, self.owner, 15);
  115. }
  116. }
  117. }
  118. else
  119. {
  120. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  121. if (self.classname == "wizspike")
  122. WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
  123. else if (self.classname == "knightspike")
  124. WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
  125. else
  126. WriteByte (MSG_BROADCAST, TE_SPIKE);
  127. WriteCoord (MSG_BROADCAST, self.origin_x);
  128. WriteCoord (MSG_BROADCAST, self.origin_y);
  129. WriteCoord (MSG_BROADCAST, self.origin_z);
  130. }
  131. remove(self);
  132. };
  133. void() superlavaspike_touch =
  134. {
  135. local float rand;
  136. local float old_armortype;
  137. //local float old_armorvalue;
  138. if (other == self.owner)
  139. return;
  140. if (other.solid == SOLID_TRIGGER)
  141. return; // trigger field, do nothing
  142. if (pointcontents(self.origin) == CONTENT_SKY)
  143. {
  144. remove(self);
  145. return;
  146. }
  147. // hit something that bleeds
  148. if (other.takedamage)
  149. {
  150. spawn_touchblood (18);
  151. // halve the effectiveness of the armor for players..
  152. if(other.classname == "player")
  153. {
  154. // save the old armor values...
  155. old_armortype = other.armortype;
  156. // old_armorvalue = other.armorvalue;
  157. other.armortype = other.armortype * 0.5;
  158. // other.armorvalue = 0;
  159. T_Damage (other, self, self.owner, 18);
  160. // if the damage didn't wipe out the armor, armortype
  161. if(other.armortype != 0)
  162. {
  163. other.armortype = old_armortype;
  164. // other.armorvalue = old_armorvalue;
  165. }
  166. }
  167. else // is a monster, do 50% more damage
  168. {
  169. if ( other.classname != "monster_lava_man")
  170. {
  171. T_Damage (other, self, self.owner, 30);
  172. }
  173. }
  174. }
  175. else
  176. {
  177. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  178. WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
  179. WriteCoord (MSG_BROADCAST, self.origin_x);
  180. WriteCoord (MSG_BROADCAST, self.origin_y);
  181. WriteCoord (MSG_BROADCAST, self.origin_z);
  182. }
  183. remove(self);
  184. };