quake-hipnotic-sdk/progs/hiprubbl.qc
1997-03-11 00:00:00 +00:00

135 lines
2.9 KiB
C++

/* rubble quickc program
by jim dose' 9/15/96
copyright (c)1996 hipnotic interactive, inc.
all rights reserved.
do not distribute.
*/
void() hiprubbletouch =
{
if ( self.ltime < self.pausetime )
return;
if (other.takedamage)
{
t_damage (other, self, self.owner, 10 );
sound (self, chan_weapon, "zombie/z_hit.wav", 1, attn_norm);
self.pausetime = self.ltime + 0.1;
}
};
void(string rubblename) hipthrowrubble =
{
local entity new;
new = spawn();
new.origin = self.origin;
setmodel (new, rubblename );
setsize (new, '0 0 0', '0 0 0');
new.velocity_x = 70 * crandom();
new.velocity_y = 70 * crandom();
new.velocity_z = 140 + 70 * random();
new.movetype = movetype_bounce;
new.solid = solid_bbox;
new.avelocity_x = random()*600;
new.avelocity_y = random()*600;
new.avelocity_z = random()*600;
new.think = sub_remove;
new.touch = hiprubbletouch;
new.ltime = time;
new.nextthink = time + 13 + random()*10;
self.pausetime = time;
new.frame = 0;
new.flags = 0;
};
void() rubble_use =
{
local float which;
local float index;
index = 0;
do
{
which = self.cnt;
if ( self.cnt == 0 )
{
which = 1 + 3*random();
which = floor( which );
}
if ( which == 1 )
{
hipthrowrubble( "progs/rubble1.mdl" );
}
else if ( which == 2 )
{
hipthrowrubble( "progs/rubble3.mdl" );
}
else
{
hipthrowrubble( "progs/rubble2.mdl" );
}
index = index + 1;
}
while( index < self.count );
};
/*quaked func_rubble (0.4 0.4 0.2) (0 0 0) (32 32 32)
spawns random sized rubble when triggered.
"count" is the number of pieces of rubble to spawn. default is 1.
*/
void() func_rubble =
{
precache_model ("progs/rubble1.mdl");
precache_model ("progs/rubble2.mdl");
precache_model ("progs/rubble3.mdl");
precache_sound ("zombie/z_hit.wav");
self.classname = "rubble";
self.cnt = 0;
self.use = rubble_use;
};
/*quaked func_rubble1 (0.4 0.4 0.2) (0 0 0) (8 8 8)
spawns small rubble when triggered.
"count" is the number of pieces of rubble to spawn. default is 1.
*/
void() func_rubble1 =
{
precache_model ("progs/rubble1.mdl");
precache_sound ("zombie/z_hit.wav");
self.classname = "rubble1";
self.cnt = 1;
self.use = rubble_use;
};
/*quaked func_rubble2 (0.4 0.4 0.2) (0 0 0) (16 16 16)
spawns medium rubble when triggered.
"count" is the number of pieces of rubble to spawn. default is 1.
*/
void() func_rubble2 =
{
precache_model ("progs/rubble3.mdl");
precache_sound ("zombie/z_hit.wav");
self.classname = "rubble2";
self.cnt = 2;
self.use = rubble_use;
};
/*quaked func_rubble3 (0.4 0.4 0.2) (0 0 0) (32 32 32)
spawns large rubble when triggered.
"count" is the number of pieces of rubble to spawn. default is 1.
*/
void() func_rubble3 =
{
precache_model ("progs/rubble2.mdl");
precache_sound ("zombie/z_hit.wav");
self.classname = "rubble3";
self.cnt = 3;
self.use = rubble_use;
};