newmisc.qc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. // Miscellaneous items used in the Rogue XPACK
  16. /*QUAKED light_lantern (0 .5 0) (-10 -10 -20) (10 10 20)
  17. Light-emitting lantern.
  18. Default light value is 200
  19. Default style is 0
  20. */
  21. void() light_lantern =
  22. {
  23. precache_model ("progs/lantern.mdl");
  24. setmodel (self, "progs/lantern.mdl");
  25. makestatic (self);
  26. };
  27. /*QUAKED light_candle (0 .5 0) (-4 -4 -10) (4 4 10)
  28. Candle
  29. Default light value is 200
  30. Default style is 0
  31. */
  32. void() light_candle =
  33. {
  34. precache_model ("progs/candle.mdl");
  35. setmodel (self, "progs/candle.mdl");
  36. makestatic (self);
  37. };
  38. // ==========================================
  39. // rubble generator
  40. // ==========================================
  41. void() rubble_touch =
  42. {
  43. if ( other.classname == "player" || other.flags & FL_MONSTER )
  44. {
  45. if ( vlen ( self.velocity ) > 0)
  46. {
  47. T_Damage ( other, self, self, 10 );
  48. }
  49. }
  50. };
  51. void() rubble_throw =
  52. {
  53. local vector throw;
  54. local entity rubble;
  55. rubble = find ( world, targetname, self.target );
  56. throw = normalize ( rubble.origin - self.origin );
  57. throw_x = throw_x + (random() * 0.2) - 0.1;
  58. throw_y = throw_y + (random() * 0.2) - 0.1;
  59. throw_z = throw_z + (random() * 0.2) - 0.1;
  60. rubble = spawn ();
  61. rubble.owner = self;
  62. rubble.classname = "rubble";
  63. rubble.movetype = MOVETYPE_BOUNCE;
  64. rubble.solid = SOLID_BBOX;
  65. rubble.velocity = throw * 300;
  66. setmodel ( rubble, "progs/rubble.mdl");
  67. setsize ( rubble, '-16 -16 -16', '16 16 16');
  68. setorigin ( rubble, self.origin );
  69. rubble.touch = rubble_touch;
  70. rubble.think = SUB_Remove;
  71. rubble.nextthink = time + 30;
  72. if (self.spawnflags & 1)
  73. rubble.skin = 1;
  74. else
  75. rubble.skin = 0;
  76. self.think = rubble_throw;
  77. self.nextthink = time + self.delay;
  78. };
  79. void() rubble_use =
  80. {
  81. if (self.wait == 0)
  82. {
  83. self.think = rubble_throw;
  84. self.nextthink = time + self.delay;
  85. self.wait = 1;
  86. }
  87. else
  88. {
  89. self.nextthink = time - 1;
  90. self.wait = 0;
  91. }
  92. };
  93. /*QUAKED rubble_generator (1 1 0) (-8 -8 -8) (8 8 8) LavaRock Active
  94. Rubble Generator - cave colored rock chunks flung at the target. Triggering the generator will turn it off and on.
  95. LavaRock - a lava rock texture, based on rich's pumice
  96. Active - start the generator immediately.
  97. delay - time between rubble pieces (Default 5 sec)
  98. */
  99. void() rubble_generator =
  100. {
  101. precache_model ("progs/rubble.mdl");
  102. if (!self.target)
  103. objerror ("rubble_generator has no target!");
  104. if (!self.delay)
  105. self.delay = 5;
  106. self.solid = SOLID_NOT;
  107. self.use = rubble_use;
  108. if (self.spawnflags & 2)
  109. rubble_use();
  110. };
  111. void() trigEx_die =
  112. {
  113. SUB_UseTargets();
  114. self.touch = SUB_Null;
  115. self.nextthink = time + 0.1;
  116. self.think = SUB_Remove;
  117. };
  118. /*QUAKED trigger_explosion (.5 .5 .5) ?
  119. Variable sized repeatable trigger. Must be targeted at one or more entities. Only set off when killed, and is only damaged by T_RadiusDamage.
  120. health: amount of damage needed to set off trigger.
  121. */
  122. void() trigger_explosion =
  123. {
  124. InitTrigger ();
  125. if (!self.health)
  126. self.health = 20;
  127. self.max_health = self.health;
  128. self.th_die = trigEx_die;
  129. self.takedamage = DAMAGE_YES;
  130. self.solid = SOLID_BBOX;
  131. setorigin (self, self.origin); // make sure it links into the world
  132. };