// ============================
void W_Seeker_Missile_Explode(entity this)
{
- self.event_damage = func_null;
- RadiusDamage(self, self.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), self.projectiledeathtype, other);
+ this.event_damage = func_null;
+ RadiusDamage(this, this.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), this.projectiledeathtype, other);
- remove(self);
+ remove(this);
}
void W_Seeker_Missile_Touch(entity this)
float dist;
float spd;
- if(time > self.cnt)
+ if(time > this.cnt)
{
- self.projectiledeathtype |= HITTYPE_SPLASH;
- W_Seeker_Missile_Explode(self);
+ this.projectiledeathtype |= HITTYPE_SPLASH;
+ W_Seeker_Missile_Explode(this);
}
- spd = vlen(self.velocity);
+ spd = vlen(this.velocity);
spd = bound(
spd - WEP_CVAR(seeker, missile_decel) * frametime,
WEP_CVAR(seeker, missile_speed_max),
spd + WEP_CVAR(seeker, missile_accel) * frametime
);
- if(self.enemy != world)
- if(self.enemy.takedamage != DAMAGE_AIM || IS_DEAD(self.enemy))
- self.enemy = world;
+ if(this.enemy != world)
+ if(this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy))
+ this.enemy = world;
- if(self.enemy != world)
+ if(this.enemy != world)
{
- e = self.enemy;
+ e = this.enemy;
eorg = 0.5 * (e.absmin + e.absmax);
turnrate = WEP_CVAR(seeker, missile_turnrate); // how fast to turn
- desireddir = normalize(eorg - self.origin);
- olddir = normalize(self.velocity); // get my current direction
- dist = vlen(eorg - self.origin);
+ desireddir = normalize(eorg - this.origin);
+ olddir = normalize(this.velocity); // get my current direction
+ dist = vlen(eorg - this.origin);
// Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
if(WEP_CVAR(seeker, missile_smart) && (dist > WEP_CVAR(seeker, missile_smart_mindist)))
{
- // Is it a better idea (shorter distance) to trace to the target itself?
- if( vdist(self.origin + olddir * self.wait, <, dist))
- traceline(self.origin, self.origin + olddir * self.wait, false, self);
+ // Is it a better idea (shorter distance) to trace to the target itthis?
+ if( vdist(this.origin + olddir * this.wait, <, dist))
+ traceline(this.origin, this.origin + olddir * this.wait, false, this);
else
- traceline(self.origin, eorg, false, self);
+ traceline(this.origin, eorg, false, this);
// Setup adaptive tracelength
- self.wait = bound(WEP_CVAR(seeker, missile_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = WEP_CVAR(seeker, missile_smart_trace_max));
+ this.wait = bound(WEP_CVAR(seeker, missile_smart_trace_min), vlen(this.origin - trace_endpos), this.wait = WEP_CVAR(seeker, missile_smart_trace_max));
// Calc how important it is that we turn and add this to the desierd (enemy) dir.
desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
}
newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
- self.velocity = newdir * spd; // make me fly in the new direction at my flight speed
+ this.velocity = newdir * spd; // make me fly in the new direction at my flight speed
}
else
dist = 0;
{
if(dist <= WEP_CVAR(seeker, missile_proxy_maxrange))
{
- if(self.autoswitch == 0)
+ if(this.autoswitch == 0)
{
- self.autoswitch = time + WEP_CVAR(seeker, missile_proxy_delay);
+ this.autoswitch = time + WEP_CVAR(seeker, missile_proxy_delay);
}
else
{
- if(self.autoswitch <= time)
+ if(this.autoswitch <= time)
{
- W_Seeker_Missile_Explode(self);
- self.autoswitch = 0;
+ W_Seeker_Missile_Explode(this);
+ this.autoswitch = 0;
}
}
}
else
{
- if(self.autoswitch != 0)
- self.autoswitch = 0;
+ if(this.autoswitch != 0)
+ this.autoswitch = 0;
}
}
///////////////
- if(IS_DEAD(self.enemy))
+ if(IS_DEAD(this.enemy))
{
- self.enemy = world;
- self.cnt = time + 1 + (random() * 4);
- self.nextthink = self.cnt;
+ this.enemy = world;
+ this.cnt = time + 1 + (random() * 4);
+ this.nextthink = this.cnt;
return;
}
- //self.angles = vectoangles(self.velocity); // turn model in the new flight direction
- self.nextthink = time;// + 0.05; // csqc projectiles
- UpdateCSQCProjectile(self);
+ //this.angles = vectoangles(this.velocity); // turn model in the new flight direction
+ this.nextthink = time;// + 0.05; // csqc projectiles
+ UpdateCSQCProjectile(this);
}
}
/*
-void W_Seeker_Missile_Animate()
+void W_Seeker_Missile_Animate(entity this)
{
- self.frame = self.frame +1;
- self.nextthink = time + 0.05;
+ this.frame = this.frame +1;
+ this.nextthink = time + 0.05;
- if(self.enemy != world)
- if(self.enemy.takedamage != DAMAGE_AIM || IS_DEAD(self.enemy))
- self.enemy = world;
+ if(this.enemy != world)
+ if(this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy))
+ this.enemy = world;
- if(self.frame == 5)
+ if(this.frame == 5)
{
- self.think = W_Seeker_Missile_Think;
- self.nextthink = time;// + cvar("g_balance_seeker_missile_activate_delay"); // cant dealy with csqc projectiles
+ this.think = W_Seeker_Missile_Think;
+ this.nextthink = time;// + cvar("g_balance_seeker_missile_activate_delay"); // cant dealy with csqc projectiles
if(autocvar_g_balance_seeker_missile_proxy)
- self.movetype = MOVETYPE_BOUNCEMISSILE;
+ this.movetype = MOVETYPE_BOUNCEMISSILE;
else
- self.movetype = MOVETYPE_FLYMISSILE;
+ this.movetype = MOVETYPE_FLYMISSILE;
}
- UpdateCSQCProjectile(self);
+ UpdateCSQCProjectile(this);
}
*/
void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, vector f_diff, entity m_target)
-{entity this = actor;
+{
entity missile;
- W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, missile_ammo));
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, missile_ammo));
- makevectors(self.v_angle);
- W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0);
+ makevectors(actor.v_angle);
+ W_SetupShot_ProjectileSize(actor, '-2 -2 -2', '2 2 2', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0);
w_shotorg += f_diff;
Send_Effect(EFFECT_SEEKER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
- //self.detornator = false;
+ //actor.detornator = false;
missile = new(seeker_missile);
- missile.owner = missile.realowner = self;
+ missile.owner = missile.realowner = actor;
missile.bot_dodge = true;
missile.bot_dodgerating = WEP_CVAR(seeker, missile_damage);
CSQCProjectile(missile, false, PROJECTILE_SEEKER, true);
- MUTATOR_CALLHOOK(EditProjectile, self, missile);
+ MUTATOR_CALLHOOK(EditProjectile, actor, missile);
}
// ============================
// ============================
void W_Seeker_Flac_Explode(entity this)
{
- self.event_damage = func_null;
+ this.event_damage = func_null;
- RadiusDamage(self, self.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), world, world, WEP_CVAR(seeker, flac_force), self.projectiledeathtype, other);
+ RadiusDamage(this, this.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), world, world, WEP_CVAR(seeker, flac_force), this.projectiledeathtype, other);
- remove(self);
+ remove(this);
}
void W_Seeker_Flac_Explode_use(entity this, entity actor, entity trigger)
}
void W_Seeker_Fire_Flac(Weapon thiswep, entity actor)
-{entity this = actor;
+{
entity missile;
vector f_diff;
float c;
- W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, flac_ammo));
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, flac_ammo));
- c = self.bulletcounter % 4;
+ c = actor.bulletcounter % 4;
switch(c)
{
case 0:
f_diff = '+1.25 +3.75 0';
break;
}
- W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage));
+ W_SetupShot_ProjectileSize(actor, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage));
w_shotorg += f_diff;
Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
missile = new(missile);
- missile.owner = missile.realowner = self;
+ missile.owner = missile.realowner = actor;
missile.bot_dodge = true;
missile.bot_dodgerating = WEP_CVAR(seeker, flac_damage);
settouch(missile, W_Seeker_Flac_Explode);
W_SetupProjVelocity_UP_PRE(missile, seeker, flac_);
CSQCProjectile(missile, true, PROJECTILE_FLAC, true);
- MUTATOR_CALLHOOK(EditProjectile, self, missile);
+ MUTATOR_CALLHOOK(EditProjectile, actor, missile);
}
// ============================
}
void W_Seeker_Attack(entity actor)
-{entity this = actor;
+{
entity tracker, closest_target;
closest_target = world;
- for(tracker = world; (tracker = find(tracker, classname, "tag_tracker")); ) if (tracker.realowner == self)
+ for(tracker = world; (tracker = find(tracker, classname, "tag_tracker")); ) if (tracker.realowner == actor)
{
if(closest_target)
{
- if(vlen2(self.origin - tracker.tag_target.origin) < vlen2(self.origin - closest_target.origin))
+ if(vlen2(actor.origin - tracker.tag_target.origin) < vlen2(actor.origin - closest_target.origin))
closest_target = tracker.tag_target;
}
else
closest_target = tracker.tag_target;
}
- traceline(self.origin + self.view_ofs, closest_target.origin, MOVE_NOMONSTERS, self);
+ traceline(actor.origin + actor.view_ofs, closest_target.origin, MOVE_NOMONSTERS, actor);
if((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target)))
closest_target = world;
void W_Seeker_Tracker_Think(entity this)
{
// commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
- if((IS_DEAD(self.realowner)) || (IS_DEAD(self.tag_target)) || (PS(self.realowner).m_switchweapon != WEP_SEEKER)
- || (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
+ if((IS_DEAD(this.realowner)) || (IS_DEAD(this.tag_target)) || (PS(this.realowner).m_switchweapon != WEP_SEEKER)
+ || (time > this.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
{
- if(self)
+ if(this)
{
- WaypointSprite_Kill(self.tag_target.wps_tag_tracker);
- remove(self);
+ WaypointSprite_Kill(this.tag_target.wps_tag_tracker);
+ remove(this);
}
return;
}
// Update the think method information
- self.nextthink = time;
+ this.nextthink = time;
}
// ============================
PROJECTILE_TOUCH(this);
- dir = normalize(self.realowner.origin - self.origin);
- org2 = findbetterlocation(self.origin, 8);
+ dir = normalize(this.realowner.origin - this.origin);
+ org2 = findbetterlocation(this.origin, 8);
te_knightspike(org2);
- self.event_damage = func_null;
- Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, other.species, self);
+ this.event_damage = func_null;
+ Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE | HITTYPE_SECONDARY, other.species, this);
if(other.takedamage == DAMAGE_AIM && !IS_DEAD(other))
{
// check to see if this person is already tagged by me
- entity tag = W_Seeker_Tagged_Info(self.realowner, other);
+ entity tag = W_Seeker_Tagged_Info(this.realowner, other);
if(tag != world)
{
}
else
{
- //sprint(self.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n"));
+ //sprint(this.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n"));
e = new(tag_tracker);
e.cnt = WEP_CVAR(seeker, missile_count);
- e.owner = self.owner;
- e.realowner = self.realowner;
+ e.owner = this.owner;
+ e.realowner = this.realowner;
if(WEP_CVAR(seeker, type) == 1)
{
if(WEP_CVAR(seeker, type) == 1)
{
- WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(seeker, tag_tracker_lifetime), 0, other, '0 0 64', self.realowner, 0, other, wps_tag_tracker, true, RADARICON_TAGGED);
+ WaypointSprite_Spawn(WP_Seeker, WEP_CVAR(seeker, tag_tracker_lifetime), 0, other, '0 0 64', this.realowner, 0, other, wps_tag_tracker, true, RADARICON_TAGGED);
WaypointSprite_UpdateRule(other.wps_tag_tracker, 0, SPRITERULE_DEFAULT);
}
}
- remove(self);
+ remove(this);
return;
}
void W_Seeker_Fire_Tag(Weapon thiswep, entity actor)
-{entity this = actor;
+{
entity missile;
- W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, tag_ammo));
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR(seeker, tag_ammo));
- W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
+ W_SetupShot_ProjectileSize(actor, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
missile = new(seeker_tag);
- missile.owner = missile.realowner = self;
+ missile.owner = missile.realowner = actor;
missile.bot_dodge = true;
missile.bot_dodgerating = 50;
settouch(missile, W_Seeker_Tag_Touch);
CSQCProjectile(missile, true, PROJECTILE_TAG, false); // has sound
- MUTATOR_CALLHOOK(EditProjectile, self, missile);
+ MUTATOR_CALLHOOK(EditProjectile, actor, missile);
}
// ============================
METHOD(Seeker, wr_aim, void(entity thiswep, entity actor))
{
- entity this = actor;
if(WEP_CVAR(seeker, type) == 1)
- if(W_Seeker_Tagged_Info(self, self.enemy) != world)
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
+ if(W_Seeker_Tagged_Info(actor, actor.enemy) != world)
+ PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
else
- PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
else
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
}
METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
METHOD(Seeker, wr_impacteffect, void(entity thiswep, entity actor))
{
- entity this = actor;
vector org2;
org2 = w_org + w_backoff * 6;
if(w_deathtype & HITTYPE_BOUNCE)
if(w_deathtype & HITTYPE_SECONDARY)
{
if(!w_issilent)
- sound(self, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM);
+ sound(actor, CH_SHOTS, SND_TAG_IMPACT, 1, ATTEN_NORM);
}
else
{
if(!w_issilent)
{
if(w_random<0.15)
- sound(self, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
+ sound(actor, CH_SHOTS, SND_TAGEXP1, 1, ATTEN_NORM);
else if(w_random<0.7)
- sound(self, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM);
+ sound(actor, CH_SHOTS, SND_TAGEXP2, 1, ATTEN_NORM);
else
- sound(self, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM);
+ sound(actor, CH_SHOTS, SND_TAGEXP3, 1, ATTEN_NORM);
}
}
}
if(!w_issilent)
{
if(w_random<0.15)
- sound(self, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM);
+ sound(actor, CH_SHOTS, SND_SEEKEREXP1, 1, ATTEN_NORM);
else if(w_random<0.7)
- sound(self, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM);
+ sound(actor, CH_SHOTS, SND_SEEKEREXP2, 1, ATTEN_NORM);
else
- sound(self, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM);
+ sound(actor, CH_SHOTS, SND_SEEKEREXP3, 1, ATTEN_NORM);
}
}
}