mirror of
https://github.com/id-Software/quake-rerelease-qc.git
synced 2024-11-24 05:01:43 +00:00
163 lines
3.8 KiB
C++
163 lines
3.8 KiB
C++
/* Copyright (C) 1996-2022 id Software LLC
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
See file, 'COPYING', for details.
|
|
*/
|
|
|
|
// Miscellaneous items used in the Rogue XPACK
|
|
|
|
|
|
/*QUAKED light_lantern (0 .5 0) (-10 -10 -20) (10 10 20)
|
|
Light-emitting lantern.
|
|
Default light value is 200
|
|
Default style is 0
|
|
*/
|
|
void() light_lantern =
|
|
{
|
|
precache_model ("progs/lantern.mdl");
|
|
setmodel (self, "progs/lantern.mdl");
|
|
makestatic (self);
|
|
};
|
|
|
|
/*QUAKED light_candle (0 .5 0) (-4 -4 -10) (4 4 10)
|
|
Candle
|
|
Default light value is 200
|
|
Default style is 0
|
|
*/
|
|
void() light_candle =
|
|
{
|
|
precache_model ("progs/candle.mdl");
|
|
setmodel (self, "progs/candle.mdl");
|
|
makestatic (self);
|
|
};
|
|
|
|
// ==========================================
|
|
// rubble generator
|
|
// ==========================================
|
|
void() rubble_touch =
|
|
{
|
|
if ( other.classname == "player" || other.flags & FL_MONSTER )
|
|
{
|
|
if ( vlen ( self.velocity ) > 0)
|
|
{
|
|
T_Damage ( other, self, self, 10 );
|
|
}
|
|
}
|
|
};
|
|
|
|
void() rubble_throw =
|
|
{
|
|
local vector throw;
|
|
local entity rubble;
|
|
|
|
rubble = find ( world, targetname, self.target );
|
|
throw = normalize ( rubble.origin - self.origin );
|
|
throw_x = throw_x + (random() * 0.2) - 0.1;
|
|
throw_y = throw_y + (random() * 0.2) - 0.1;
|
|
throw_z = throw_z + (random() * 0.2) - 0.1;
|
|
|
|
rubble = spawn ();
|
|
rubble.owner = self;
|
|
rubble.classname = "rubble";
|
|
rubble.movetype = MOVETYPE_BOUNCE;
|
|
rubble.solid = SOLID_BBOX;
|
|
rubble.velocity = throw * 300;
|
|
setmodel ( rubble, "progs/rubble.mdl");
|
|
setsize ( rubble, '-16 -16 -16', '16 16 16');
|
|
setorigin ( rubble, self.origin );
|
|
rubble.touch = rubble_touch;
|
|
|
|
rubble.think = SUB_Remove;
|
|
rubble.nextthink = time + 30;
|
|
|
|
if (self.spawnflags & 1)
|
|
rubble.skin = 1;
|
|
else
|
|
rubble.skin = 0;
|
|
|
|
self.think = rubble_throw;
|
|
self.nextthink = time + self.delay;
|
|
};
|
|
|
|
void() rubble_use =
|
|
{
|
|
if (self.wait == 0)
|
|
{
|
|
self.think = rubble_throw;
|
|
self.nextthink = time + self.delay;
|
|
self.wait = 1;
|
|
}
|
|
else
|
|
{
|
|
self.nextthink = time - 1;
|
|
self.wait = 0;
|
|
}
|
|
};
|
|
|
|
/*QUAKED rubble_generator (1 1 0) (-8 -8 -8) (8 8 8) LavaRock Active
|
|
Rubble Generator - cave colored rock chunks flung at the target. Triggering the generator will turn it off and on.
|
|
|
|
LavaRock - a lava rock texture, based on rich's pumice
|
|
Active - start the generator immediately.
|
|
|
|
delay - time between rubble pieces (Default 5 sec)
|
|
*/
|
|
void() rubble_generator =
|
|
{
|
|
precache_model ("progs/rubble.mdl");
|
|
|
|
if (!self.target)
|
|
objerror ("rubble_generator has no target!");
|
|
|
|
if (!self.delay)
|
|
self.delay = 5;
|
|
|
|
self.solid = SOLID_NOT;
|
|
self.use = rubble_use;
|
|
|
|
if (self.spawnflags & 2)
|
|
rubble_use();
|
|
};
|
|
|
|
|
|
void() trigEx_die =
|
|
{
|
|
SUB_UseTargets();
|
|
|
|
self.touch = SUB_Null;
|
|
self.nextthink = time + 0.1;
|
|
self.think = SUB_Remove;
|
|
};
|
|
|
|
/*QUAKED trigger_explosion (.5 .5 .5) ?
|
|
Variable sized repeatable trigger. Must be targeted at one or more entities. Only set off when killed, and is only damaged by T_RadiusDamage.
|
|
|
|
health: amount of damage needed to set off trigger.
|
|
*/
|
|
void() trigger_explosion =
|
|
{
|
|
InitTrigger ();
|
|
|
|
if (!self.health)
|
|
self.health = 20;
|
|
|
|
self.max_health = self.health;
|
|
self.th_die = trigEx_die;
|
|
self.takedamage = DAMAGE_YES;
|
|
self.solid = SOLID_BBOX;
|
|
setorigin (self, self.origin); // make sure it links into the world
|
|
};
|
|
|