djcev.com

//

Git Repos / fte_dogmode / qc / projectiles / spike.qc

Last update to this file was on 2025-08-13 at 05:20.

Show spike.qc

//======================================================================
// Nails
//======================================================================

//======================================================================
// constants
//======================================================================

const float SPIKE_NORMAL_DAMAGE = 9; // direct damage; 9 is id1
const float SPIKE_SUPER_DAMAGE = 18; // superspike direct damage; 18 is id1
const float SPIKE_DUPER_DAMAGE = 36; // superduperspike direct; 36 is pd3
const float SPIKE_SPLASH_DAMAGE = 36; // splash damage
const float SPIKE_EXPLOD_DAMAGE = 36; // direct damage
const float SPIKE_SPEED = 1000; // id1 player spikes move at 1000ups

const vector SPIKE_MINS = '0 0 0'; // let's not change this -- CEV
const vector SPIKE_MAXS = '0 0 0'; //

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

// projectile_spike
entity(entity src, vector org, vector vel, optional float direct)
spawn_projectile_spike;
void(entity e) projectile_spike_init;
strip void() projectile_spike;

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

//----------------------------------------------------------------------
// class projectile_spike: base_projectile
// {
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, optional float direct)
spawn_projectile_spike =
{
local entity e = spawn();
e.owner = src;
e.enemy = src.enemy;
e.origin = org;
e.velocity = vel;
e.dmg = direct;
// was .projexpl -- CEV
e.style2 = src.style2;
// homing setup
e.homing = src.homing;

projectile_spike_init (e);
return e;
};

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

e.classname = "spike";
e.classtype = CT_PROJECTILE_SPIKE;
e.movetype = MOVETYPE_FLYMISSILE;
e.solid = SOLID_BBOX;
e.touch = base_projectile_touch;
if (base_projectile_parse_projexpl(e.style2, 0))
e.aflag |= PROJECTILE_EXPLOSIVE;
e.angles = vectoangles (e.velocity);

if (!e.dmg)
if (e.aflag & PROJECTILE_EXPLOSIVE)
e.dmg = SPIKE_EXPLOD_DAMAGE;
else
e.dmg = SPIKE_NORMAL_DAMAGE;

if (!e.dmg_splash)
if (e.aflag & PROJECTILE_EXPLOSIVE)
e.dmg_splash = SPIKE_SPLASH_DAMAGE;
else
e.dmg_splash = 0;

// this is kinda wonky -- CEV
if (e.dmg == SPIKE_SUPER_DAMAGE)
// supernail
setmodel (e, "progs/s_spike.mdl");
else if (e.dmg == SPIKE_DUPER_DAMAGE)
// superdupernail
setmodel (e, "progs/lspike.mdl");
else
// regular nail
setmodel (e, "progs/spike.mdl");

e.skin = 0;

if (e.homing > 0)
{
base_projectile_setup_homing (e, SPIKE_SPEED);
}
else
{
e.think = sub_remove;
e.nextthink = time + 6;
}

setsize (e, SPIKE_MINS, SPIKE_MAXS);
setorigin (e, e.origin);
};

//--------------------------------------------------------------
strip void() projectile_spike =
{
projectile_spike_init (self);
};
// };

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

Log spike.qc

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