djcev.com

//

Git Repos / fte_dogmode / qc / projectiles / rocket.qc

Last update to this file was on 2024-06-15 at 19:50.

Show rocket.qc

//======================================================================
// Rockets
//======================================================================

//======================================================================
// constants
//======================================================================
const float ROCKET_DIRECT_DAMAGE = 100; // direct damage; 100 is id1
const float ROCKET_SPLASH_DAMAGE = 120; // splash damage; 120 is id1
const float ROCKET_SPEED = 1000; // id1 1000ups
const float ROCKET_HEALTH = 50; // explodes when dead

// found using FTE's sv_gameplayfix_setmodelrealbox
// const vector ROCKET_MINS = '-9.75537 -3.24751 -3.1833';
// const vector ROCKET_MAXS = '8.52919 3.144 3.13116';
const vector ROCKET_MINS = '-9 -4 -4'; // slightly more regular bounds
const vector ROCKET_MAXS = '9 4 4';

//======================================================================
// forward declarations
//======================================================================

// projectile_rocket
void(vector dir) projectile_rocket_destroy;
entity(entity src, vector org, vector vel, optional float projspeed)
spawn_projectile_rocket;
void(entity e) projectile_rocket_init;
strip void() projectile_rocket;

//------------------------------------------------------------------------------

//----------------------------------------------------------------------
// class projectile_rocket: base_projectile
// {
//--------------------------------------------------------------
void(vector dir) projectile_rocket_destroy =
{
if (self.aflag & PROJECTILE_DESTROYED)
return;

self.aflag |= PROJECTILE_DESTROYED;
self.destroy = sub_nulldestroy;
self.think = sub_null;
self.touch = sub_null;
base_projectile_touch ();
};

//--------------------------------------------------------------
entity(entity src, vector org, vector vel, optional float projspeed)
spawn_projectile_rocket =
{
local entity e = spawn ();
e.owner = src;
e.origin = org;
e.velocity = vel;
// damage
e.direct_damage = ROCKET_DIRECT_DAMAGE;
e.splash_damage = ROCKET_SPLASH_DAMAGE;
// speed
e.proj_basespeed = projspeed;
e.proj_speed_mod = src.proj_speed_mod;
// model, skin, & sounds
e.mdl_proj = src.mdl_proj;
e.skin_proj = src.skin_proj;
e.snd_hit = src.snd_hit;

projectile_rocket_init (e);
return e;
};

//--------------------------------------------------------------
void(entity e) projectile_rocket_init =
{
base_projectile_init (e);

e.classname = "missile";
e.classtype = CT_PROJECTILE_ROCKET;
e.movetype = MOVETYPE_FLYMISSILE;
e.solid = SOLID_BBOX;
// e.destroy = projectile_rocket_destroy;
e.aflag |= PROJECTILE_EXPLOSIVE;
// e.health = ROCKET_HEALTH;
// e.takedamage = DAMAGE_YES;
e.angles = vectoangles (e.velocity);

if (!e.proj_basespeed)
e.proj_basespeed = ROCKET_SPEED;

if (!e.direct_damage)
e.direct_damage = ROCKET_DIRECT_DAMAGE;

if (!e.splash_damage)
e.splash_damage = ROCKET_SPLASH_DAMAGE;

// dumptruck_ds custom_mdls
if (e.mdl_proj != "")
setmodel (e, e.mdl_proj);
else
setmodel (e, "progs/missile.mdl");

// dumptruck_ds
if (e.skin_proj)
e.skin = e.skin_proj;
else
e.skin = 0;

// homing & missile duration
if (e.homing > 0)
{
base_projectile_setup_homing (e,
e.proj_basespeed * e.proj_speed_mod);
}
else
{
e.think = sub_remove;
e.nextthink = time + 5;
}

// setsize (e, ROCKET_MINS, ROCKET_MAXS);
setsize (e, '0 0 0', '0 0 0');
setorigin (e, e.origin);
};

//--------------------------------------------------------------
strip void() projectile_rocket =
{
projectile_rocket_init (self);
};
// };

Return to the top of this page or return to the overview of this repo.

Log rocket.qc

Return to the top of this page or return to the overview of this repo.