Git Repos / fte_dogmode / qc / projectiles / bolt.qc
Last update to this file was on 2024-07-03 at 07:20.
Show bolt.qc
//==============================================================================
// Tribolt projectile -- using DOE minigrenade assets -- CEV
//==============================================================================
//======================================================================
// constants
//======================================================================
const float BOLT_SPEED = 1200; // 1600ups in QC
const float BOLT_DIRECT_DAMAGE = 35; // 35 in QC
const float BOLT_SPLASH_DAMAGE = 35; // 35 damage per bolt in QC
const float BOLT_SPLASH_MINIMUM = 10; // minimum splash damage per bolt
const float BOLT_SPLASH_RADIUS = 100; // same as grenade
const float BOLT_FIRING_DELAY = 0.125f; // 0.125 in QC
const float BOLT_LIFETIME = 0.8; // 0.6 in QC; 0.8 * 1200 = 960
const vector BOLT_MINS = '0 0 0'; // zero size for mininades
const vector BOLT_MAXS = '0 0 0';
//======================================================================
// forward declarations
//======================================================================
// projectile_bolt
void() projectile_bolt_think;
void() projectile_bolt_think_delay;
void() projectile_bolt_touch;
entity(entity src, float d) spawn_projectile_bolt;
void(entity e) projectile_bolt_init_velocity;
void(entity e) projectile_bolt_init;
strip void() projectile_bolt;
//------------------------------------------------------------------------------
//----------------------------------------------------------------------
// class projectile_bolt: base_projectile
// {
//--------------------------------------------------------------
void() projectile_bolt_explode =
{
if (self.takedamage)
self.takedamage = DAMAGE_NO;
t_radiusdamage3 (self, self.owner, self.splash_damage,
100, BOLT_SPLASH_MINIMUM, other);
// BecomeExplosion
pointparticles (particleeffectnum("te_explosion2_230_5"),
self.origin);
sound (self, CHAN_WEAPON, "cev/tribolt/boltexpl.ogg",
1.0, ATTN_NORM);
become_base_explosion (self);
};
//--------------------------------------------------------------
void() projectile_bolt_think =
{
projectile_bolt_explode ();
};
//--------------------------------------------------------------
void() projectile_bolt_think_delay =
{
if (self.owner && self.owner.health > 0)
{
self.origin = self.owner.origin;
if (self.owner.classgroup & CG_MONSTER)
self.owner.effects |= EF_MUZZLEFLASH;
projectile_bolt_init_velocity (self);
projectile_bolt_init (self);
}
else
{
// remove on next tick -- CEV
self.think = sub_remove;
self.nextthink = time + 0.1;
}
};
//--------------------------------------------------------------
void() projectile_bolt_touch =
{
if (base_projectile_check_touch())
return;
if (other.takedamage == DAMAGE_AIM)
{
t_damage2 (other, self, self.owner,
self.direct_damage);
projectile_bolt_explode ();
return;
}
// stop dead at whatever point we hit -- CEV
sound (self, CHAN_WEAPON, "weapons/bounce.wav",
VOL_HIGH, ATTN_NORM);
self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0';
self.avelocity = '0 0 0';
};
//--------------------------------------------------------------
// arguments are source entity, origin, velocity, and delay -- CEV
//--------------------------------------------------------------
entity(entity src, float d) spawn_projectile_bolt =
{
local entity e = spawn ();
e.owner = src;
e.origin = src.origin;
// damage
e.direct_damage = BOLT_DIRECT_DAMAGE;
e.splash_damage = BOLT_SPLASH_DAMAGE;
// model, skin, & sounds
e.mdl_proj = src.mdl_proj;
e.skin_proj = src.skin_proj;
e.snd_hit = src.snd_hit;
if (d)
{
// delay spawning
e.think = projectile_bolt_think_delay;
e.nextthink = time + d;
}
else
{
// spawn now
if (e.owner.classgroup & CG_MONSTER)
e.owner.effects |= EF_MUZZLEFLASH;
projectile_bolt_init_velocity (e);
projectile_bolt_init (e);
}
return e;
};
//--------------------------------------------------------------
void(entity e) projectile_bolt_init_velocity =
{
if (e.owner && e.owner.health > 0)
{
if (e.owner.classgroup & CG_MONSTER)
{
if (e.owner.attack_elevation)
{
local vector ang = e.owner.angles;
ang_x = -e.owner.attack_elevation;
makevectors (ang);
e.velocity = v_forward * BOLT_SPEED +
crandom() * v_right * 10 +
crandom() * v_up * 10;
}
else
{
e.velocity = normalize (
e.enemy.origin - e.origin);
e.velocity *= BOLT_SPEED;
e.velocity_z = 200;
}
}
else if (e.owner.v_angle_x)
{
makevectors (e.owner.v_angle);
e.velocity = v_forward * BOLT_SPEED +
v_up * 200 +
crandom() * v_right * 10 +
crandom() * v_up * 10;
}
else
{
e.velocity = aim (e.owner, 10000);
e.velocity *= BOLT_SPEED;
e.velocity_z = 200;
}
}
else
{
// remove on next tick -- CEV
e.think = sub_remove;
e.nextthink = time + 0.1;
}
}
//--------------------------------------------------------------
void(entity e) projectile_bolt_init =
{
base_projectile_init (e);
e.classname = "projectile_bolt";
e.classtype = CT_PROJECTILE_BOLT;
e.movetype = MOVETYPE_TOSS;
e.solid = SOLID_BBOX;
e.think = projectile_bolt_think;
e.touch = projectile_bolt_touch;
e.aflag |= PROJECTILE_EXPLOSIVE;
e.angles = vectoangles (e.velocity);
if (!e.avelocity)
e.avelocity = '300 300 300';
if (!e.splash_damage)
e.splash_damage = BOLT_SPLASH_DAMAGE;
// DOE multi grenade model but at half the size -- CEV
setmodel (e, "progs/mervup.mdl");
e.skin = 0;
e.scale = 0.5;
setsize (e, BOLT_MINS, BOLT_MAXS);
setorigin (e, e.origin);
// set missile duration
e.nextthink = time + BOLT_LIFETIME;
};
//--------------------------------------------------------------
strip void() projectile_bolt =
{
projectile_bolt_init (self);
};
// };
Return to the top of this page or return to the overview of this repo.
Log bolt.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-07-03 | pmove changes and fixes, improved climbing | cev | +1 | -1 |
2024-06-26 | pmove fixes, GL now a faux tribolt, wall climbing | cev | +221 |
Return to the top of this page or return to the overview of this repo.