djcev.com

//

Git Repos / fte_dogmode / qc / projectiles / zombiechunk.qc

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

Show zombiechunk.qc

//==============================================================================
// Zombie grenade projectile
//==============================================================================

//======================================================================
// constants
//======================================================================
const float ZCHUNK_DIRECT_DAMAGE = 10; // direct damage; 10 is id1
// zombie chunks don't splash
const float ZCHUNK_SPEED = 600; // id1 default 600

const vector ZCHUNK_MINS = '0 0 0'; // let's not change this -- CEV
const vector ZCHUNK_MAXS = '0 0 0'; //

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

// projectile_zombiechunk
void() projectile_zombiechunk_touch;
entity(entity src, vector org, vector vel) spawn_projectile_zombiechunk;
void(entity e) projectile_zombiechunk_init;
strip void() projectile_zombiechunk;

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

//----------------------------------------------------------------------
// class projectile_zombiechunk: base_projectile
// {
//--------------------------------------------------------------
// ZombieGrenadeTouch
//--------------------------------------------------------------
void() projectile_zombiechunk_touch =
{
if (base_projectile_check_touch())
return;

if (other.takedamage)
{
// hardcoded 10 damage -- CEV
t_damage2 (other, self, self.owner, self.direct_damage);
sound (self, CHAN_WEAPON, "zombie/z_hit.wav",
1, ATTN_NORM);
remove (self);
return;
}

// bounce sound
sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM);
self.velocity = '0 0 0';
self.avelocity = '0 0 0';
self.touch = sub_remove;
};

//--------------------------------------------------------------
entity(entity src, vector org, vector vel)
spawn_projectile_zombiechunk =
{
local entity e = spawn ();
e.owner = src;
e.origin = org;
e.velocity = vel;
e.avelocity = src.cust_avelocity;
// damage
e.direct_damage = ZCHUNK_DIRECT_DAMAGE;
// model, skin, & sounds
e.mdl_proj = src.mdl_proj;
e.skin_proj = src.skin_proj;
e.snd_hit = src.snd_hit;

projectile_zombiechunk_init (e);
return e;
};

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

e.classname = "zgibs";
e.classtype = CT_PROJECTILE_ZOMBIECHUNK;
e.movetype = MOVETYPE_BOUNCE;
e.solid = SOLID_BBOX;
e.touch = projectile_zombiechunk_touch;
e.angles = vectoangles (e.velocity);

if (!e.avelocity)
e.avelocity = '3000 1000 2000';

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

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

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

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

setsize (e, ZCHUNK_MINS, ZCHUNK_MAXS);
setorigin (e, e.origin);

// set missile duration
e.nextthink = time + 2.5;
e.think = sub_remove;
};

//--------------------------------------------------------------
strip void() projectile_zombiechunk =
{
projectile_zombiechunk_init (self);
};
// };

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

Log zombiechunk.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 +77 -34
2024-02-18 Client/player, projectiles, entrypoints refactor cev +77  

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