Git Repos / fte_dogmode / qc / projectiles / laser.qc
Last update to this file was on 2024-06-15 at 19:50.
Show laser.qc
//==============================================================================
// Laser Projectile (Enforcers, etc)
//==============================================================================
//======================================================================
// constants
//======================================================================
const float LASER_DIRECT_DAMAGE = 15; // direct damage; 15 is id1
// lasers don't splash
const float LASER_SPEED = 600; // id1 laser speed is 600
const vector LASER_MINS = '0 0 0'; // let's not change this -- CEV
const vector LASER_MAXS = '0 0 0'; //
//======================================================================
// forward declarations
//======================================================================
// projectile_laser
void() projectile_laser_touch;
entity(entity src, vector org, vector vel) spawn_projectile_laser;
void(entity e) projectile_laser_init;
strip void() projectile_laser;
//------------------------------------------------------------------------------
//----------------------------------------------------------------------
// class projectile_laser: base_projectile
// {
//--------------------------------------------------------------
void() projectile_laser_touch =
{
// dumptruck_ds
sound_hit (self, CHAN_WEAPON, "enforcer/enfstop.wav",
VOL_HIGH, ATTN_STATIC);
local vector org = self.origin - 8 * normalize (self.velocity);
if (other.health)
{
spawn_blood (org, self.velocity * 0.2,
self.direct_damage);
t_damage2 (other, self, self.owner,
self.direct_damage);
}
else
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
}
remove (self);
};
//--------------------------------------------------------------
entity(entity src, vector org, vector vel) spawn_projectile_laser =
{
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;
projectile_laser_init (e);
return e;
};
//--------------------------------------------------------------
void(entity e) projectile_laser_init =
{
base_projectile_init (e);
e.classname = "projectile_laser";
e.classtype = CT_PROJECTILE_LASERBEAM;
e.movetype = MOVETYPE_FLY;
e.solid = SOLID_BBOX;
e.touch = projectile_laser_touch;
e.effects = EF_DIMLIGHT;
e.angles = vectoangles (e.velocity);
if (!e.proj_basespeed)
e.proj_basespeed = LASER_SPEED;
if (!e.direct_damage)
e.direct_damage = LASER_DIRECT_DAMAGE;
// dumptruck_ds
if (e.mdl_proj != "")
setmodel (e, e.mdl_proj);
else
setmodel (e, "progs/laser.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.nextthink = time + 5;
e.think = sub_remove;
}
setsize (e, LASER_MINS, LASER_MAXS);
setorigin (e, e.origin);
};
//--------------------------------------------------------------
strip void() projectile_laser =
{
projectile_laser_init (self);
};
// };
Return to the top of this page or return to the overview of this repo.
Log laser.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-06-15 | Major update, committing as-is, will have bugs | cev | +1 | -1 |
2024-04-05 | Player footsteps, shareware monsters, misc? | cev | +1 | |
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +77 | -32 |
2024-02-18 | Client/player, projectiles, entrypoints refactor | cev | +83 | |
2024-01-31 | Class based monster refactor & start projectiles | cev |
Return to the top of this page or return to the overview of this repo.