djcev.com

//

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

Last update to this file was on 2024-04-05 at 14:18.

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,
optional float projspeed) 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,
optional float projspeed) spawn_projectile_spike =
{
local entity e = spawn();
e.owner = src;
e.enemy = src.enemy;
e.origin = org;
e.velocity = vel;
e.direct_damage = direct;
e.projexpl = src.projexpl;
// homing setup
e.homing = src.homing;
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_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.projexpl, 0))
e.aflag |= PROJECTILE_EXPLOSIVE;
e.angles = vectoangles (e.velocity);

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

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

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

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

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

if (e.homing > 0)
{
base_projectile_setup_homing (e,
e.proj_basespeed * e.proj_speed_mod);
}
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

Date Commit Message Author + -
2024-04-05 Player footsteps, shareware monsters, misc? cev +1  
2024-03-24 2nd pass refactor, rework QC class structure cev +83 -41
2024-02-18 Client/player, projectiles, entrypoints refactor cev +68 -207
2024-01-31 Class based monster refactor & start projectiles cev +223  

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