djcev.com

//

Git Repos / fte_dogmode / qc / projectiles / flak.qc

Last update to this file was on 2024-06-26 at 03:47.

Show flak.qc

//==============================================================================
// Flak
// BDW 31/08/00 - evil, nasty red-hot nail cluster-bomb attack...
// from Marcher -- dumptruck_ds
//==============================================================================

//======================================================================
// constants
//======================================================================
const float FLAK_DIRECT_DAMAGE = 8; // default direct damage; was 4
// flak doesn't splash
const float FLAK_SPEED = 800; // speed of BDW's OgreFireFlak

const vector FLAK_MINS = '0 0 0'; // let's not change this -- CEV
const vector FLAK_MAXS = '0 0 0'; //

const float MONSTER_FLAK_OGRE = 4; // TODO CEV remove

//======================================================================
// fields
//======================================================================

// bdw - saves up flak hits to do a single damage next frame -
// currently only used for flak ogre
.float spikecount;

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

// projectile_flak
void() projectile_flak_think_damage;
void() projectile_flak_touch;
entity(entity src, vector org, vector vel) spawn_projectile_flak;
void(entity e) projectile_flak_init;
strip void() projectile_flak;

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

//----------------------------------------------------------------------
// class projectile_flak: base_projectile
// {
//--------------------------------------------------------------
// FlakDoDamage
//--------------------------------------------------------------
void() projectile_flak_think_damage =
{
// get correct gib direction
self.origin = self.oldenemy.origin + self.oldorigin;
t_damage2 (self.oldenemy, self, self.owner,
self.oldenemy.spikecount);
self.oldenemy.spikecount = 0;
remove (self);
};

//--------------------------------------------------------------
// FlakTouch
//--------------------------------------------------------------
void() projectile_flak_touch =
{
if (base_projectile_check_touch())
return;

// hit something that bleeds
if (other.takedamage)
{
spawn_touchblood (self.direct_damage);

if (other.spikecount)
{
// not the first one
other.spikecount += self.direct_damage;
remove (self);
return;
}

sound (self, CHAN_VOICE, "fish/bite.wav",
VOL_HIGH, ATTN_NORM);

// the first one...
other.spikecount = self.direct_damage;

// stick around for a little while...
self.velocity = '0 0 0';
self.solid = SOLID_NOT;
self.touch = sub_null;
self.model = __NULL__;
// displacement from enemy origin (its gonna
// move next frame)
self.oldorigin = self.origin - other.origin;
self.oldenemy = other;
self.think = projectile_flak_think_damage;
self.nextthink = time + 0.05;
return;
}

WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);

// bit of a hack
if (self.spawnflags & MONSTER_FLAK_OGRE)
{
remove (self);
return;
}

// gets weaker with each bounce.
// also stops them getting stuck in world.
self.direct_damage = self.direct_damage - 5;
if (self.direct_damage <= 0)
{
remove (self);
return;
}

// reduce crazy ricochets
self.velocity = self.velocity * 0.5;
self.movetype = MOVETYPE_BOUNCE;
};

//--------------------------------------------------------------
entity(entity src, vector org, vector vel) spawn_projectile_flak =
{
local entity e = spawn();
e.owner = src;
e.enemy = src.enemy;
e.origin = org;
e.velocity = vel;
// parameters for homing
e.homing = src.homing;
e.proj_speed_mod = src.proj_speed_mod;
e.waitmin = src.waitmin;
// model, skin, & sounds
e.mdl_proj = src.mdl_proj;
e.skin_proj = src.skin_proj;
e.snd_hit = src.snd_hit;
// hack to tell FlakTouch this was spawned by an ogre
if (src.classtype == CT_MONSTER_OGRE)
e.spawnflags |= MONSTER_FLAK_OGRE;

projectile_flak_init (e);
return e;
};

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

e.classname = "projectile_flak";
e.classtype = CT_PROJECTILE_FLAK;
// flymissile is a bit too all-seeing for this gun...
e.movetype = MOVETYPE_FLY;
e.solid = SOLID_BBOX;
e.touch = projectile_flak_touch;
e.flags = FL_NOSELECT;
e.angles = vectoangles (e.velocity);

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

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

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

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

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, FLAK_MINS, FLAK_MAXS);
setorigin (e, e.origin);
};

//--------------------------------------------------------------
strip void() projectile_flak =
{
projectile_flak_init (self);
};
// };

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

Log flak.qc

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