newitems.qc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. // New Items
  16. //
  17. // Items added for the Rogue XPACK.
  18. void() sphere_spawn;
  19. void(entity theEntity) UpdateAmmoCounts =
  20. {
  21. if ( self.weapon >= IT_LAVA_NAILGUN )
  22. {
  23. theEntity.ammo_shells = theEntity.ammo_shells1;
  24. theEntity.ammo_nails = theEntity.ammo_lava_nails;
  25. theEntity.ammo_rockets = theEntity.ammo_multi_rockets;
  26. theEntity.ammo_cells = theEntity.ammo_plasma;
  27. }
  28. else
  29. {
  30. theEntity.ammo_shells = theEntity.ammo_shells1;
  31. theEntity.ammo_nails = theEntity.ammo_nails1;
  32. theEntity.ammo_rockets = theEntity.ammo_rockets1;
  33. theEntity.ammo_cells = theEntity.ammo_cells1;
  34. }
  35. };
  36. void() newitems_touch =
  37. {
  38. if (other.classname != "player")
  39. return;
  40. if (other.health <= 0)
  41. return;
  42. // only one per person, please.
  43. if (self.classname == "item_sphere")
  44. if (other.items2 & IT2_V_SPHERE)
  45. return;
  46. sprint(other, "$qc_got_item", self.netname);
  47. if (deathmatch)
  48. {
  49. if (self.classname == "item_random_powerup")
  50. {
  51. self.nextthink = time + 60;
  52. self.think = random_regen;
  53. }
  54. else if (self.classname == "item_sphere")
  55. {
  56. self.mdl = self.model;
  57. self.nextthink = time + 60*3;
  58. self.think = SUB_regen;
  59. }
  60. else
  61. {
  62. self.mdl = self.model;
  63. self.nextthink = time + 60;
  64. self.think = SUB_regen;
  65. }
  66. }
  67. sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  68. stuffcmd (other, "bf\n");
  69. self.solid = SOLID_NOT;
  70. other.items = other.items | self.items;
  71. other.items2 = other.items2 | self.items2;
  72. self.model = string_null;
  73. // do the apropriate action
  74. if (self.netname == "$qc_power_shield")
  75. {
  76. other.shield_time = 1;
  77. other.shield_finished = time + 30;
  78. }
  79. else if (self.netname == "$qc_anti_grav_belt")
  80. {
  81. other.antigrav_time = 1;
  82. other.antigrav_finished = time + 45;
  83. other.gravity = 0.25;
  84. }
  85. else if (self.classname == "item_sphere")
  86. {
  87. other.items2 = other.items2 | IT2_V_SPHERE;
  88. sphere_spawn();
  89. }
  90. activator = other;
  91. SUB_UseTargets(); // fire all targets / killtargets
  92. };
  93. /*QUAKED item_powerup_shield (0 .5 .8) (-16 -16 -24) (16 16 32)
  94. The shield upgrade
  95. */
  96. void() item_powerup_shield =
  97. {
  98. self.touch = newitems_touch;
  99. precache_model ("progs/shield.mdl");
  100. precache_model ("progs/p_shield.mdl");
  101. precache_sound ("shield/pickup.wav");
  102. precache_sound ("shield/hit.wav");
  103. precache_sound ("shield/fadeout.wav");
  104. self.noise = "shield/pickup.wav";
  105. setmodel (self, "progs/shield.mdl");
  106. self.netname = "$qc_power_shield";
  107. self.items2 = IT2_SHIELD;
  108. setsize (self, '-16 -16 -24', '16 16 32');
  109. StartItem ();
  110. };
  111. /*QUAKED item_powerup_belt (0 .5 .8) (-16 -16 -24) (16 16 32)
  112. The anti-grav belt
  113. */
  114. void() item_powerup_belt =
  115. {
  116. self.touch = newitems_touch;
  117. precache_model ("progs/beltup.mdl");
  118. precache_sound ("belt/pickup.wav");
  119. precache_sound ("belt/use.wav");
  120. precache_sound ("belt/fadeout.wav");
  121. self.noise = "belt/pickup.wav";
  122. setmodel (self, "progs/beltup.mdl");
  123. self.netname = "$qc_anti_grav_belt";
  124. self.items2 = IT2_ANTIGRAV;
  125. setsize (self, '-16 -16 -24', '16 16 32');
  126. StartItem ();
  127. };