const float MIN_DAMAGEEXTRARADIUS = 2;
const float MAX_DAMAGEEXTRARADIUS = 16;
.float damageextraradius;
-.void(float thisdmg, int hittype, vector org, vector thisforce) event_damage;
+.void(entity this, float thisdmg, int hittype, vector org, vector thisforce) event_damage;
// only for Porto
float angles_held_status;
self.nextthink = time + 0.2;
}
-void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce)
-{SELFPARAM();
+void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector thisforce)
+{
if (thisforce.z < 0)
thisforce.z = 0;
- self.move_velocity = self.move_velocity + thisforce + '0 0 100';
- self.move_flags &= ~FL_ONGROUND;
+ this.move_velocity = this.move_velocity + thisforce + '0 0 100';
+ this.move_flags &= ~FL_ONGROUND;
}
NET_HANDLE(casings, bool isNew)
self.silent = 1;
if(self.event_damage)
- self.event_damage(thisdmg, w_deathtype, w_org, thisforce);
+ self.event_damage(self, thisdmg, w_deathtype, w_org, thisforce);
DamageEffect(w_org, thisdmg, w_deathtype, species);
}
void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker)
-{SELFPARAM();
+{
if(g_cts) // no gibs in CTS
return;
e.state = type; // should stay smaller than 15
if(!sound_allowed(MSG_BROADCAST, gibowner) || !sound_allowed(MSG_BROADCAST, attacker))
e.state |= 0x40; // "silence" bit
- e.state |= 8 * self.species; // gib type, ranges from 0 to 15
+ e.state |= 8 * gibowner.species; // gib type, ranges from 0 to 15
// if this is a copied dead body, send the num of its player instead
// TODO: remove this field, read from model txt files
- if(self.classname == "body")
- e.team = etof(self.enemy);
+ if(gibowner.classname == "body")
+ e.team = etof(gibowner.enemy);
else
- e.team = etof(self);
+ e.team = etof(gibowner);
setorigin(e, org);
e.velocity = dir;
return 0;
}
-void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
if(damage <= 0) { return; }
- if (self.owner.isshielded)
+ if (this.owner.isshielded)
{
// this is protected by a shield, so ignore the damage
- if (time > self.pain_finished)
+ if (time > this.pain_finished)
if (IS_PLAYER(attacker))
{
play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
- self.pain_finished = time + 1;
+ this.pain_finished = time + 1;
attacker.typehitsound += 1; // play both sounds (shield is way too quiet)
}
}
if(IS_PLAYER(attacker))
- if(time - ons_notification_time[self.team] > 10)
+ if(time - ons_notification_time[this.team] > 10)
{
- play2team(self.team, SND(ONS_CONTROLPOINT_UNDERATTACK));
- ons_notification_time[self.team] = time;
+ play2team(this.team, SND(ONS_CONTROLPOINT_UNDERATTACK));
+ ons_notification_time[this.team] = time;
}
- self.health = self.health - damage;
- if(self.owner.iscaptured)
- WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
+ this.health = this.health - damage;
+ if(this.owner.iscaptured)
+ WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
else
- WaypointSprite_UpdateBuildFinished(self.owner.sprite, time + (self.max_health - self.health) / (self.count / ONS_CP_THINKRATE));
- self.pain_finished = time + 1;
+ WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - this.health) / (this.count / ONS_CP_THINKRATE));
+ this.pain_finished = time + 1;
// particles on every hit
pointparticles(EFFECT_SPARKS, hitloc, force*-1, 1);
//sound on every hit
if (random() < 0.5)
- sound(self, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM);
+ sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE+0.3, ATTEN_NORM);
else
- sound(self, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM);
+ sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM);
- if (self.health < 0)
+ if (this.health < 0)
{
- sound(self, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_CPDESTROYED_), self.owner.message, attacker.netname);
+ sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_CPDESTROYED_), this.owner.message, attacker.netname);
PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
PlayerScore_Add(attacker, SP_SCORE, 10);
- self.owner.goalentity = world;
- self.owner.islinked = false;
- self.owner.iscaptured = false;
- self.owner.team = 0;
- self.owner.colormap = 1024;
+ this.owner.goalentity = world;
+ this.owner.islinked = false;
+ this.owner.iscaptured = false;
+ this.owner.team = 0;
+ this.owner.colormap = 1024;
- WaypointSprite_UpdateMaxHealth(self.owner.sprite, 0);
+ WaypointSprite_UpdateMaxHealth(this.owner.sprite, 0);
onslaught_updatelinks();
// Use targets now (somebody make sure this is in the right place..)
- setself(self.owner);
- activator = self;
- SUB_UseTargets ();
+ setself(this.owner);
+ activator = this;
+ WITH(entity, self, this, SUB_UseTargets());
setself(this);
- self.owner.waslinked = self.owner.islinked;
- if(self.owner.model != "models/onslaught/controlpoint_pad.md3")
- setmodel_fixsize(self.owner, MDL_ONS_CP_PAD1);
- //setsize(self, '-32 -32 0', '32 32 8');
+ this.owner.waslinked = this.owner.islinked;
+ if(this.owner.model != "models/onslaught/controlpoint_pad.md3")
+ setmodel_fixsize(this.owner, MDL_ONS_CP_PAD1);
+ //setsize(this, '-32 -32 0', '32 32 8');
- remove(self);
+ remove(this);
}
- self.SendFlags |= CPSF_STATUS;
+ this.SendFlags |= CPSF_STATUS;
}
void ons_ControlPoint_Icon_Think()
self.SendFlags |= CPSF_STATUS;
if(self.health <= 0)
{
- ons_ControlPoint_Icon_Damage(self, self, 1, 0, self.origin, '0 0 0');
+ ons_ControlPoint_Icon_Damage(self, self, self, 1, 0, self.origin, '0 0 0');
return;
}
}
}
}
-void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
if(damage <= 0) { return; }
if(warmup_stage || gameover) { return; }
if(!round_handler_IsRoundStarted()) { return; }
- if (attacker != self)
+ if (attacker != this)
{
- if (self.isshielded)
+ if (this.isshielded)
{
// this is protected by a shield, so ignore the damage
- if (time > self.pain_finished)
+ if (time > this.pain_finished)
if (IS_PLAYER(attacker))
{
play2(attacker, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
attacker.typehitsound += 1;
- self.pain_finished = time + 1;
+ this.pain_finished = time + 1;
}
return;
}
- if (time > self.pain_finished)
+ if (time > this.pain_finished)
{
- self.pain_finished = time + 10;
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, self), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK)));
- play2team(self.team, SND(ONS_GENERATOR_UNDERATTACK));
+ this.pain_finished = time + 10;
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && SAME_TEAM(it, this), LAMBDA(Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_GENERATOR_UNDERATTACK)));
+ play2team(this.team, SND(ONS_GENERATOR_UNDERATTACK));
}
}
- self.health = self.health - damage;
- WaypointSprite_UpdateHealth(self.sprite, self.health);
+ this.health = this.health - damage;
+ WaypointSprite_UpdateHealth(this.sprite, this.health);
// choose an animation frame based on health
- self.frame = 10 * bound(0, (1 - self.health / self.max_health), 1);
+ this.frame = 10 * bound(0, (1 - this.health / this.max_health), 1);
// see if the generator is still functional, or dying
- if (self.health > 0)
+ if (this.health > 0)
{
- self.lasthealth = self.health;
+ this.lasthealth = this.health;
}
else
{
- if (attacker == self)
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME_));
+ if (attacker == this)
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_GENDESTROYED_OVERTIME_));
else
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(self.team, INFO_ONSLAUGHT_GENDESTROYED_));
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(this.team, INFO_ONSLAUGHT_GENDESTROYED_));
PlayerScore_Add(attacker, SP_SCORE, 100);
}
- self.iscaptured = false;
- self.islinked = false;
- self.isshielded = false;
- self.takedamage = DAMAGE_NO; // can't be hurt anymore
- self.event_damage = func_null; // won't do anything if hurt
- self.count = 0; // reset counter
- self.think = func_null;
- self.nextthink = 0;
- //self.think(); // do the first explosion now
-
- WaypointSprite_UpdateMaxHealth(self.sprite, 0);
- WaypointSprite_Ping(self.sprite);
- //WaypointSprite_Kill(self.sprite); // can't do this yet, code too poor
+ this.iscaptured = false;
+ this.islinked = false;
+ this.isshielded = false;
+ this.takedamage = DAMAGE_NO; // can't be hurt anymore
+ this.event_damage = func_null; // won't do anything if hurt
+ this.count = 0; // reset counter
+ this.think = func_null;
+ this.nextthink = 0;
+ //this.think(); // do the first explosion now
+
+ WaypointSprite_UpdateMaxHealth(this.sprite, 0);
+ WaypointSprite_Ping(this.sprite);
+ //WaypointSprite_Kill(this.sprite); // can't do this yet, code too poor
onslaught_updatelinks();
}
// Throw some flaming gibs on damage, more damage = more chance for gib
if(random() < damage/220)
{
- sound(self, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ sound(this, CH_TRIGGER, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
}
else
{
//sound on every hit
if (random() < 0.5)
- sound(self, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM);
+ sound(this, CH_TRIGGER, SND_ONS_HIT1, VOL_BASE, ATTEN_NORM);
else
- sound(self, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM);
+ sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM);
}
- self.SendFlags |= GSF_STATUS;
+ this.SendFlags |= GSF_STATUS;
}
void ons_GeneratorThink()
self.nextthink = time + 0.2;
}
-void M_Shambler_Attack_Lightning_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if (self.health <= 0)
+void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if (this.health <= 0)
return;
- if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+ if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
+ this.health = this.health - damage;
- if (self.health <= 0)
- W_PrepareExplosionByDamage(attacker, self.use);
+ if (this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
}
void M_Shambler_Attack_Lightning_Touch()
Unfreeze(this);
this.health = 0;
if(this.event_damage)
- this.event_damage(this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
+ this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
}
else if ( this.revive_progress <= 0 )
this.moveto = this.origin;
}
-void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- self.health -= damage;
+void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ this.health -= damage;
- Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
+ Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
- if(self.health <= -50) // 100 health until gone?
+ if(this.health <= -50) // 100 health until gone?
{
- Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
+ Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
// number of monsters spawned with mobspawn command
totalspawned -= 1;
- self.think = SUB_Remove_self;
- self.nextthink = time + 0.1;
- self.event_damage = func_null;
+ this.think = SUB_Remove_self;
+ this.nextthink = time + 0.1;
+ this.event_damage = func_null;
}
}
W_ThrowNewWeapon(this, this.weapon, 0, this.origin, randomvec() * 150 + '0 0 325');
}
-void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype))
+void Monster_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if((this.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL.m_id && !ITEM_DAMAGE_NEEDKILL(deathtype))
return;
- if(STAT(FROZEN, self) && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id)
+ if(STAT(FROZEN, this) && deathtype != DEATH_KILL.m_id && deathtype != DEATH_NADE_ICE_FREEZE.m_id)
return;
- //if(time < self.pain_finished && deathtype != DEATH_KILL.m_id)
+ //if(time < this.pain_finished && deathtype != DEATH_KILL.m_id)
//return;
- if(time < self.spawnshieldtime && deathtype != DEATH_KILL.m_id)
+ if(time < this.spawnshieldtime && deathtype != DEATH_KILL.m_id)
return;
- if(deathtype == DEATH_FALL.m_id && self.draggedby != world)
+ if(deathtype == DEATH_FALL.m_id && this.draggedby != world)
return;
vector v;
float take, save;
- v = healtharmor_applydamage(100, self.armorvalue / 100, deathtype, damage);
+ v = healtharmor_applydamage(100, this.armorvalue / 100, deathtype, damage);
take = v_x;
save = v_y;
damage_take = take;
frag_attacker = attacker;
frag_deathtype = deathtype;
- Monster mon = get_monsterinfo(self.monsterid);
- mon.mr_pain(mon, self);
+ Monster mon = get_monsterinfo(this.monsterid);
+ mon.mr_pain(mon, this);
take = damage_take;
if(take)
{
- self.health -= take;
- Monster_Sound(self, monstersound_pain, 1.2, true, CH_PAIN);
+ this.health -= take;
+ Monster_Sound(this, monstersound_pain, 1.2, true, CH_PAIN);
}
- if(self.sprite)
- WaypointSprite_UpdateHealth(self.sprite, self.health);
+ if(this.sprite)
+ WaypointSprite_UpdateHealth(this.sprite, this.health);
- self.dmg_time = time;
+ this.dmg_time = time;
if(sound_allowed(MSG_BROADCAST, attacker) && deathtype != DEATH_DROWN.m_id)
- spamsound (self, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
+ spamsound (this, CH_PAIN, SND(BODYIMPACT1), VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
- self.velocity += force * self.damageforcescale;
+ this.velocity += force * this.damageforcescale;
if(deathtype != DEATH_DROWN.m_id && take)
{
- Violence_GibSplash_At(hitloc, force, 2, bound(0, take, 200) / 16, self, attacker);
+ Violence_GibSplash_At(hitloc, force, 2, bound(0, take, 200) / 16, this, attacker);
if (take > 50)
- Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker);
+ Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker);
if (take > 100)
- Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker);
+ Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
}
- if(self.health <= 0)
+ if(this.health <= 0)
{
if(deathtype == DEATH_KILL.m_id)
- self.candrop = false; // killed by mobkill command
+ this.candrop = false; // killed by mobkill command
// TODO: fix this?
activator = attacker;
- other = self.enemy;
- SUB_UseTargets();
- self.target2 = self.oldtarget2; // reset to original target on death, incase we respawn
+ other = this.enemy;
+ WITH(entity, self, this, SUB_UseTargets());
+ this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
- Monster_Dead(self, attacker, (self.health <= -100 || deathtype == DEATH_KILL.m_id));
+ Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id));
- WaypointSprite_Kill(self.sprite);
+ WaypointSprite_Kill(this.sprite);
- frag_target = self;
- MUTATOR_CALLHOOK(MonsterDies, attacker);
+ MUTATOR_CALLHOOK(MonsterDies, this, attacker);
- if(self.health <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
+ if(this.health <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
{
- Violence_GibSplash(self, 1, 0.5, attacker);
+ Violence_GibSplash(this, 1, 0.5, attacker);
- self.think = SUB_Remove_self;
- self.nextthink = time + 0.1;
+ this.think = SUB_Remove_self;
+ this.nextthink = time + 0.1;
}
}
}
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
if(self.event_damage)
- self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+ self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
self.bloodloss_timer = time + 0.5 + random() * 0.5;
}
}
self.nextthink = max(self.wait, time);
}
-void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
- self.takedamage = DAMAGE_NO;
- nade_boom();
+ this.takedamage = DAMAGE_NO;
+ WITH(entity, self, this, nade_boom());
return;
}
- if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id)
+ if(this.nade_type == NADE_TYPE_TRANSLOCATE.m_id || this.nade_type == NADE_TYPE_SPAWN.m_id)
return;
if (MUTATOR_CALLHOOK(Nade_Damage, DEATH_WEAPONOF(deathtype), force, damage)) {}
else if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER))
{
force *= 6;
- damage = self.max_health * 0.55;
+ damage = this.max_health * 0.55;
}
else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN))
- damage = self.max_health * 0.1;
+ damage = this.max_health * 0.1;
else if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO
{
if(deathtype & HITTYPE_SECONDARY)
{
- damage = self.max_health * 0.1;
+ damage = this.max_health * 0.1;
force *= 10;
}
else
- damage = self.max_health * 1.15;
+ damage = this.max_health * 1.15;
}
- self.velocity += force;
- UpdateCSQCProjectile(self);
+ this.velocity += force;
+ UpdateCSQCProjectile(this);
- if(damage <= 0 || ((IS_ONGROUND(self)) && IS_PLAYER(attacker)))
+ if(damage <= 0 || ((IS_ONGROUND(this)) && IS_PLAYER(attacker)))
return;
- if(self.health == self.max_health)
+ if(this.health == this.max_health)
{
- sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
- self.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
- self.think = nade_beep;
+ sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
+ this.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
+ this.think = nade_beep;
}
- self.health -= damage;
+ this.health -= damage;
- if ( self.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
- self.realowner = attacker;
+ if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
+ this.realowner = attacker;
- if(self.health <= 0)
- W_PrepareExplosionByDamage(attacker, nade_boom);
+ if(this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom));
else
- nade_burn_spawn(self);
+ nade_burn_spawn(this);
}
void toss_nade(entity e, vector _velocity, float _time)
}
MUTATOR_HOOKFUNCTION(nades, MonsterDies)
-{SELFPARAM();
+{
if(IS_PLAYER(frag_attacker))
- if(DIFF_TEAM(frag_attacker, self))
- if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
+ if(DIFF_TEAM(frag_attacker, frag_target))
+ if(!(frag_target.spawnflags & MONSTERFLAG_SPAWNED))
nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor);
return false;
W_RocketPropelledChainsaw_Explode();
}
-void W_RocketPropelledChainsaw_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if (self.health <= 0)
+void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if (this.health <= 0)
return;
- if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+ if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
+ this.health = this.health - damage;
- if (self.health <= 0)
- W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode);
+ if (this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
}
void W_RocketPropelledChainsaw_Think()
}
}
-void physical_item_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(!self.cnt) // not for dropped items
+void physical_item_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(!this.cnt) // not for dropped items
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
- setorigin(self, self.spawn_origin);
- self.angles = self.spawn_angles;
+ setorigin(this, this.spawn_origin);
+ this.angles = this.spawn_angles;
}
}
WaypointSprite_Kill(self.waypointsprite_attached);
}
-void WaypointSprite_PlayerDead()
-{SELFPARAM();
- WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime);
- WaypointSprite_DetachCarrier(self);
+void WaypointSprite_PlayerDead(entity this)
+{
+ WaypointSprite_Disown(this.waypointsprite_attached, waypointsprite_deadlifetime);
+ WaypointSprite_DetachCarrier(this);
}
void WaypointSprite_PlayerGone()
void WaypointSprite_ClearOwned();
-void WaypointSprite_PlayerDead();
+void WaypointSprite_PlayerDead(entity this);
void WaypointSprite_PlayerGone();
#endif
if (check.move_movetype == 32) // MOVETYPE_PHYSICS
{
check.move_origin = check.move_origin + move;
- WITH(entity, this, check, _Movetype_LinkEdict(this, true));
+ _Movetype_LinkEdict(check, true);
continue;
}
// try moving the contacted entity
this.solid = SOLID_NOT;
bool flag = false;
- WITH(entity, this, check, {
- flag = _Movetype_PushEntity(this, move, true);
- });
+ flag = _Movetype_PushEntity(check, move, true);
if (!flag)
{
// entity "check" got teleported
return item.bot_pickupbasevalue * c;
}
-void Item_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
- RemoveItem();
+ WITH(entity, self, this, RemoveItem());
}
void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
// Otherwise mdl_dead will be displayed at the map origin, and nobody would
// want that!
-void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
//
// func_breakable
self.message = oldmsg;
}
-void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.state == 1)
+void func_breakable_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.state == 1)
return;
- if(self.spawnflags & DOOR_NOSPLASH)
+ if(this.spawnflags & DOOR_NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
- if(self.team)
- if(attacker.team == self.team)
+ if(this.team)
+ if(attacker.team == this.team)
return;
- self.pain_finished = time;
- self.health = self.health - damage;
- if(self.sprite)
+ this.pain_finished = time;
+ this.health = this.health - damage;
+ if(this.sprite)
{
- WaypointSprite_Ping(self.sprite);
- WaypointSprite_UpdateHealth(self.sprite, self.health);
+ WaypointSprite_Ping(this.sprite);
+ WaypointSprite_UpdateHealth(this.sprite, this.health);
}
- func_breakable_colormod();
+ WITH(entity, self, this, func_breakable_colormod());
- if(self.health <= 0)
+ if(this.health <= 0)
{
debrisforce = force;
- self.takedamage = DAMAGE_NO;
- self.event_damage = func_null;
+ this.takedamage = DAMAGE_NO;
+ this.event_damage = func_null;
- if(IS_CLIENT(attacker) && self.classname == "func_assault_destructible")
+ if(IS_CLIENT(attacker) && this.classname == "func_assault_destructible")
{
- self.owner = attacker;
- self.realowner = attacker;
+ this.owner = attacker;
+ this.realowner = attacker;
}
// do not explode NOW but in the NEXT FRAME!
// because recursive calls to RadiusDamage are not allowed
- self.nextthink = time;
- self.think = func_breakable_destroy;
+ this.nextthink = time;
+ this.think = func_breakable_destroy;
}
}
button_fire ();
}
-void button_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.spawnflags & DOOR_NOSPLASH)
+void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.spawnflags & DOOR_NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
- self.health = self.health - damage;
- if (self.health <= 0)
+ this.health = this.health - damage;
+ if (this.health <= 0)
{
- self.enemy = damage_attacker;
- button_fire ();
+ this.enemy = damage_attacker;
+ WITH(entity, self, this, button_fire());
}
}
}
}
-void door_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.spawnflags & DOOR_NOSPLASH)
+void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.spawnflags & DOOR_NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
- self.health = self.health - damage;
+ this.health = this.health - damage;
- if (self.itemkeys)
+ if (this.itemkeys)
{
// don't allow opening doors through damage if keys are required
return;
}
- if (self.health <= 0)
+ if (this.health <= 0)
{
- self.owner.health = self.owner.max_health;
- self.owner.takedamage = DAMAGE_NO; // wil be reset upon return
- WITH(entity, self, self.owner, door_use());
+ this.owner.health = this.owner.max_health;
+ this.owner.takedamage = DAMAGE_NO; // wil be reset upon return
+ WITH(entity, self, this.owner, door_use());
}
}
_sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
}
-void fd_secret_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
- fd_secret_use();
+ WITH(entity, self, this, fd_secret_use());
}
// Wait after first movement...
multi_trigger ();
}
-void multi_eventdamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if (!self.takedamage)
+void multi_eventdamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(!this.takedamage)
return;
- if(self.spawnflags & DOOR_NOSPLASH)
+ if(this.spawnflags & DOOR_NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
- self.health = self.health - damage;
- if (self.health <= 0)
+ this.health = this.health - damage;
+ if (this.health <= 0)
{
- self.enemy = attacker;
- self.goalentity = inflictor;
- multi_trigger();
+ this.enemy = attacker;
+ this.goalentity = inflictor;
+ WITH(entity, self, this, multi_trigger());
}
}
}
}
-void turret_damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
-{SELFPARAM();
+void turret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
+{
// Enough already!
- if(self.deadflag == DEAD_DEAD)
+ if(this.deadflag == DEAD_DEAD)
return;
// Inactive turrets take no damage. (hm..)
- if(!self.active)
+ if(!this.active)
return;
- if(SAME_TEAM(self, attacker))
+ if(SAME_TEAM(this, attacker))
{
if(autocvar_g_friendlyfire)
damage = damage * autocvar_g_friendlyfire;
return;
}
- self.health -= damage;
+ this.health -= damage;
// thorw head slightly off aim when hit?
- if (self.damage_flags & TFL_DMG_HEADSHAKE)
+ if (this.damage_flags & TFL_DMG_HEADSHAKE)
{
- self.tur_head.angles_x = self.tur_head.angles_x + (-0.5 + random()) * damage;
- self.tur_head.angles_y = self.tur_head.angles_y + (-0.5 + random()) * damage;
+ this.tur_head.angles_x = this.tur_head.angles_x + (-0.5 + random()) * damage;
+ this.tur_head.angles_y = this.tur_head.angles_y + (-0.5 + random()) * damage;
- self.SendFlags |= TNSF_ANG;
+ this.SendFlags |= TNSF_ANG;
}
- if (self.turret_flags & TUR_FLAG_MOVE)
- self.velocity = self.velocity + vforce;
+ if (this.turret_flags & TUR_FLAG_MOVE)
+ this.velocity = this.velocity + vforce;
- if (self.health <= 0)
+ if (this.health <= 0)
{
- self.event_damage = func_null;
- self.tur_head.event_damage = func_null;
- self.takedamage = DAMAGE_NO;
- self.nextthink = time;
- self.think = turret_die;
+ this.event_damage = func_null;
+ this.tur_head.event_damage = func_null;
+ this.takedamage = DAMAGE_NO;
+ this.nextthink = time;
+ this.think = turret_die;
}
- self.SendFlags |= TNSF_STATUS;
+ this.SendFlags |= TNSF_STATUS;
}
void() turret_think;
turret_projectile_explode();
}
-void turret_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
-{SELFPARAM();
- self.velocity += vforce;
- self.health -= damage;
- //self.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
- if(self.health <= 0)
- W_PrepareExplosionByDamage(self.owner, turret_projectile_explode);
+void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
+{
+ this.velocity += vforce;
+ this.health -= damage;
+ //this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
+ if(this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
}
entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
remove (self);
}
-void walker_rocket_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
-{SELFPARAM();
- self.health = self.health - damage;
- self.velocity = self.velocity + vforce;
+void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
+{
+ this.health = this.health - damage;
+ this.velocity = this.velocity + vforce;
- if (self.health <= 0)
- W_PrepareExplosionByDamage(self.owner, walker_rocket_explode);
+ if (this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
}
#define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
}
// projectile handling
-void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void vehicles_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
// Ignore damage from oterh projectiles from my owner (dont mess up volly's)
- if(inflictor.owner == self.owner)
+ if(inflictor.owner == this.owner)
return;
- self.health -= damage;
- self.velocity += force;
- if(self.health < 1)
+ this.health -= damage;
+ this.velocity += force;
+ if(this.health < 1)
{
- self.takedamage = DAMAGE_NO;
- self.event_damage = func_null;
- self.think = self.use;
- self.nextthink = time;
+ this.takedamage = DAMAGE_NO;
+ this.event_damage = func_null;
+ this.think = this.use;
+ this.nextthink = time;
}
}
vehicles_painframe(this);
}
-void vehicles_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- self.dmg_time = time;
+void vehicles_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ this.dmg_time = time;
// WEAPONTODO
if(DEATH_ISWEAPON(deathtype, WEP_VORTEX))
if(DEATH_WEAPONOF(deathtype) != WEP_Null)
damage *= autocvar_g_vehicles_weapon_damagerate;
- self.enemy = attacker;
+ this.enemy = attacker;
- self.pain_finished = time;
+ this.pain_finished = time;
- if((self.vehicle_flags & VHF_HASSHIELD) && (self.vehicle_shield > 0))
+ if((this.vehicle_flags & VHF_HASSHIELD) && (this.vehicle_shield > 0))
{
- if (wasfreed(self.vehicle_shieldent) || self.vehicle_shieldent == world)
+ if (wasfreed(this.vehicle_shieldent) || this.vehicle_shieldent == world)
{
- self.vehicle_shieldent = spawn();
- self.vehicle_shieldent.effects = EF_LOWPRECISION;
-
- setmodel(self.vehicle_shieldent, MDL_VEH_SHIELD);
- setattachment(self.vehicle_shieldent, self, "");
- setorigin(self.vehicle_shieldent, real_origin(self) - self.origin);
- self.vehicle_shieldent.scale = 256 / vlen(self.maxs - self.mins);
- self.vehicle_shieldent.think = shieldhit_think;
+ this.vehicle_shieldent = spawn();
+ this.vehicle_shieldent.effects = EF_LOWPRECISION;
+
+ setmodel(this.vehicle_shieldent, MDL_VEH_SHIELD);
+ setattachment(this.vehicle_shieldent, this, "");
+ setorigin(this.vehicle_shieldent, real_origin(this) - this.origin);
+ this.vehicle_shieldent.scale = 256 / vlen(this.maxs - this.mins);
+ this.vehicle_shieldent.think = shieldhit_think;
}
- self.vehicle_shieldent.colormod = '1 1 1';
- self.vehicle_shieldent.alpha = 0.45;
- self.vehicle_shieldent.angles = vectoangles(normalize(hitloc - (self.origin + self.vehicle_shieldent.origin))) - self.angles;
- self.vehicle_shieldent.nextthink = time;
- self.vehicle_shieldent.effects &= ~EF_NODRAW;
+ this.vehicle_shieldent.colormod = '1 1 1';
+ this.vehicle_shieldent.alpha = 0.45;
+ this.vehicle_shieldent.angles = vectoangles(normalize(hitloc - (this.origin + this.vehicle_shieldent.origin))) - this.angles;
+ this.vehicle_shieldent.nextthink = time;
+ this.vehicle_shieldent.effects &= ~EF_NODRAW;
- self.vehicle_shield -= damage;
+ this.vehicle_shield -= damage;
- if(self.vehicle_shield < 0)
+ if(this.vehicle_shield < 0)
{
- self.vehicle_health -= fabs(self.vehicle_shield);
- self.vehicle_shieldent.colormod = '2 0 0';
- self.vehicle_shield = 0;
- self.vehicle_shieldent.alpha = 0.75;
+ this.vehicle_health -= fabs(this.vehicle_shield);
+ this.vehicle_shieldent.colormod = '2 0 0';
+ this.vehicle_shield = 0;
+ this.vehicle_shieldent.alpha = 0.75;
if(sound_allowed(MSG_BROADCAST, attacker))
- spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
+ spamsound (this, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
}
else
if(sound_allowed(MSG_BROADCAST, attacker))
- spamsound (self, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
+ spamsound (this, CH_PAIN, "onslaught/electricity_explode.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
}
else
{
- self.vehicle_health -= damage;
+ this.vehicle_health -= damage;
if(sound_allowed(MSG_BROADCAST, attacker))
- spamsound (self, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
+ spamsound (this, CH_PAIN, "onslaught/ons_hit2.wav", VOL_BASE, ATTEN_NORM); // FIXME: PLACEHOLDER
}
- if(self.damageforcescale < 1 && self.damageforcescale > 0)
- self.velocity += force * self.damageforcescale;
+ if(this.damageforcescale < 1 && this.damageforcescale > 0)
+ this.velocity += force * this.damageforcescale;
else
- self.velocity += force;
+ this.velocity += force;
- if(self.vehicle_health <= 0)
+ if(this.vehicle_health <= 0)
{
- if(self.owner)
- if(self.vehicle_flags & VHF_DEATHEJECT)
- vehicles_exit(VHEF_EJECT);
+ if(this.owner)
+ if(this.vehicle_flags & VHF_DEATHEJECT)
+ WITH(entity, self, this, vehicles_exit(VHEF_EJECT));
else
- vehicles_exit(VHEF_RELEASE);
+ WITH(entity, self, this, vehicles_exit(VHEF_RELEASE));
- antilag_clear(self);
+ antilag_clear(this);
- Vehicle info = Vehicles_from(self.vehicleid);
- info.vr_death(info, self);
- vehicles_setreturn(self);
+ Vehicle info = Vehicles_from(this.vehicleid);
+ info.vr_death(info, this);
+ vehicles_setreturn(this);
}
}
float autocvar_g_vehicle_raptor_flare_range;
void raptor_flare_think();
-void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
void raptor_flare_touch();
METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
remove(self);
}
-void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- self.health -= damage;
- if(self.health <= 0)
- remove(self);
+void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ this.health -= damage;
+ if(this.health <= 0)
+ remove(this);
}
void raptor_flare_think()
W_Devastator_Explode();
}
-void W_Devastator_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+ if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
- self.angles = vectoangles(self.velocity);
+ this.health = this.health - damage;
+ this.angles = vectoangles(this.velocity);
- if(self.health <= 0)
- W_PrepareExplosionByDamage(attacker, W_Devastator_Explode);
+ if(this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
}
void W_Devastator_Attack(Weapon thiswep)
}
}
-void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
// note: combos are usually triggered by W_Electro_TriggerCombo, not damage
float is_combo = (inflictor.classname == "electro_orb_chain" || inflictor.classname == "electro_bolt");
- if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_combo ? 1 : -1)))
+ if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_combo ? 1 : -1)))
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
- if(self.health <= 0)
+ this.health = this.health - damage;
+ if(this.health <= 0)
{
- self.takedamage = DAMAGE_NO;
- self.nextthink = time;
+ this.takedamage = DAMAGE_NO;
+ this.nextthink = time;
if(is_combo)
{
// change owner to whoever caused the combo explosion
- self.realowner = inflictor.realowner;
- self.classname = "electro_orb_chain";
- self.think = W_Electro_ExplodeCombo;
- self.nextthink = time +
+ this.realowner = inflictor.realowner;
+ this.classname = "electro_orb_chain";
+ this.think = W_Electro_ExplodeCombo;
+ this.nextthink = time +
(
// bound the length, inflictor may be in a galaxy far far away (warpzones)
min(
WEP_CVAR(electro, combo_radius),
- vlen(self.origin - inflictor.origin)
+ vlen(this.origin - inflictor.origin)
)
/
// delay combo chains, looks cooler
}
else
{
- self.use = W_Electro_Explode;
- self.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
+ this.use = W_Electro_Explode;
+ this.think = adaptor_think2use; // not _hittype_splash, as this runs "immediately"
}
}
}
self.nextthink = time + 0.1;
}
-void W_Fireball_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+ if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
- if(self.health <= 0)
+ this.health = this.health - damage;
+ if(this.health <= 0)
{
- self.cnt = 1;
- W_PrepareExplosionByDamage(attacker, W_Fireball_Explode);
+ this.cnt = 1;
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
}
}
remove(self);
}
-void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == self.owner) : true)
+ float is_linkexplode = ( ((inflictor.owner != world) ? (inflictor.owner == this.owner) : true)
&& (inflictor.projectiledeathtype & HITTYPE_SECONDARY)
- && (self.projectiledeathtype & HITTYPE_SECONDARY));
+ && (this.projectiledeathtype & HITTYPE_SECONDARY));
if(is_linkexplode)
is_linkexplode = (is_linkexplode && WEP_CVAR_SEC(hagar, load_linkexplode));
else
is_linkexplode = -1; // not secondary load, so continue as normal without exception.
- if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, is_linkexplode))
+ if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, is_linkexplode))
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
- self.angles = vectoangles(self.velocity);
+ this.health = this.health - damage;
+ this.angles = vectoangles(this.velocity);
- if(self.health <= 0)
- W_PrepareExplosionByDamage(attacker, self.think);
+ if(this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
}
void W_Hagar_Touch()
self.movetype = MOVETYPE_NONE;
}
-void W_Hook_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+ if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
+ this.health = this.health - damage;
- if(self.health <= 0)
- W_PrepareExplosionByDamage(self.realowner, W_Hook_Explode2);
+ if(this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
}
void W_Hook_Touch2()
}
}
-void W_MineLayer_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- float is_from_enemy = (inflictor.realowner != self.realowner);
+ float is_from_enemy = (inflictor.realowner != this.realowner);
- if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_from_enemy ? 1 : -1)))
+ if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_from_enemy ? 1 : -1)))
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
- self.angles = vectoangles(self.velocity);
+ this.health = this.health - damage;
+ this.angles = vectoangles(this.velocity);
- if(self.health <= 0)
- W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode);
+ if(this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
}
void W_MineLayer_Attack(Weapon thiswep)
}
-void W_Mortar_Grenade_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+ if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
- self.health = self.health - damage;
+ this.health = this.health - damage;
- if(self.health <= 0)
- W_PrepareExplosionByDamage(attacker, self.use);
+ if(this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
}
void W_Mortar_Grenade_Think1()
-void W_Seeker_Missile_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- if(!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+ if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
- if(self.realowner == attacker)
- self.health = self.health - (damage * 0.25);
+ if(this.realowner == attacker)
+ this.health = this.health - (damage * 0.25);
else
- self.health = self.health - damage;
+ this.health = this.health - damage;
- if(self.health <= 0)
- W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode);
+ if(this.health <= 0)
+ WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
}
/*
// ============================
// Begin: Tag projectile
// ============================
-void W_Seeker_Tag_Explode()
-{SELFPARAM();
- //if(other==self.realowner)
+void W_Seeker_Tag_Explode(entity this)
+{
+ //if(other==this.realowner)
// return;
- Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, self);
+ Damage_DamageInfo(this.origin, 0, 0, 0, this.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, this);
- remove(self);
+ remove(this);
}
-void W_Seeker_Tag_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- self.health = self.health - damage;
- if(self.health <= 0)
- W_Seeker_Tag_Explode();
+ this.health = this.health - damage;
+ if(this.health <= 0)
+ W_Seeker_Tag_Explode(this);
}
void W_Seeker_Tag_Touch()
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
- WaypointSprite_PlayerDead();
+ WaypointSprite_PlayerDead(self);
if(!mutator_returnvalue) // mutator prevents resetting teams
self.team = -1; // move this as it is needed to log the player spectating in eventlog
*/
.float clientkill_nexttime;
-void ClientKill_Now_TeamChange()
-{SELFPARAM();
- if(self.killindicator_teamchange == -1)
+void ClientKill_Now_TeamChange(entity this)
+{
+ if(this.killindicator_teamchange == -1)
{
- JoinBestTeam( self, false, true );
+ JoinBestTeam( this, false, true );
}
- else if(self.killindicator_teamchange == -2)
+ else if(this.killindicator_teamchange == -2)
{
if(blockSpectators)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
- PutObserverInServer();
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
+ WITH(entity, self, this, PutObserverInServer());
}
else
- SV_ChangeTeam(self.killindicator_teamchange - 1);
- self.killindicator_teamchange = 0;
+ WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1));
+ this.killindicator_teamchange = 0;
}
void ClientKill_Now()
self.killindicator = world;
if(self.killindicator_teamchange)
- ClientKill_Now_TeamChange();
+ ClientKill_Now_TeamChange(self);
if(IS_PLAYER(self))
Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
if(self.event_damage)
- self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+ self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
}
if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
- self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
+ self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
}
else if ( self.revive_progress <= 0 )
Unfreeze(self);
animdecide_setimplicitstate(self, (IS_ONGROUND(self)));
}
-void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
float take, save;
vector v;
- Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
+ Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
// damage resistance (ignore most of the damage from a bullet or similar)
damage = max(damage - 5, 1);
- v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
+ v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
take = v.x;
save = v.y;
if(sound_allowed(MSG_BROADCAST, attacker))
{
if (save > 10)
- sound (self, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM);
+ sound (this, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM);
else if (take > 30)
- sound (self, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM);
+ sound (this, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM);
else if (take > 10)
- sound (self, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM);
+ sound (this, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM);
}
if (take > 50)
- Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker);
+ Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker);
if (take > 100)
- Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker);
+ Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
- self.armorvalue = self.armorvalue - save;
- self.health = self.health - take;
+ this.armorvalue = this.armorvalue - save;
+ this.health = this.health - take;
// pause regeneration for 5 seconds
- self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
+ this.pauseregen_finished = max(this.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
- self.dmg_save = self.dmg_save + save;//max(save - 10, 0);
- self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
- self.dmg_inflictor = inflictor;
+ this.dmg_save = this.dmg_save + save;//max(save - 10, 0);
+ this.dmg_take = this.dmg_take + take;//max(take - 10, 0);
+ this.dmg_inflictor = inflictor;
- if (self.health <= -autocvar_sv_gibhealth && self.alpha >= 0)
+ if (this.health <= -autocvar_sv_gibhealth && this.alpha >= 0)
{
// don't use any animations as a gib
- self.frame = 0;
+ this.frame = 0;
// view just above the floor
- self.view_ofs = '0 0 4';
+ this.view_ofs = '0 0 4';
- Violence_GibSplash(self, 1, 1, attacker);
- self.alpha = -1;
- self.solid = SOLID_NOT; // restore later
- self.takedamage = DAMAGE_NO; // restore later
- self.damagedbycontents = false;
+ Violence_GibSplash(this, 1, 1, attacker);
+ this.alpha = -1;
+ this.solid = SOLID_NOT; // restore later
+ this.takedamage = DAMAGE_NO; // restore later
+ this.damagedbycontents = false;
}
}
this.respawn_flags = this.respawn_flags | RESPAWN_FORCE;
}
-void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
float take, save, dh, da;
vector v;
float valid_damage_for_weaponstats;
float excess;
- dh = max(self.health, 0);
- da = max(self.armorvalue, 0);
+ dh = max(this.health, 0);
+ da = max(this.armorvalue, 0);
if(!DEATH_ISSPECIAL(deathtype))
{
- damage *= sqrt(bound(1.0, self.cvar_cl_handicap, 100.0));
- if(self != attacker)
+ damage *= sqrt(bound(1.0, this.cvar_cl_handicap, 100.0));
+ if(this != attacker)
damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0));
}
vector ear1, ear2;
vector d;
float f;
- ear1 = self.origin;
- ear1_z += 0.125 * self.view_ofs.z + 0.875 * self.maxs.z; // 7/8
+ ear1 = this.origin;
+ ear1_z += 0.125 * this.view_ofs.z + 0.875 * this.maxs.z; // 7/8
ear2 = ear1;
- makevectors(self.angles);
+ makevectors(this.angles);
ear1 += v_right * -10;
ear2 += v_right * +10;
- d = inflictor.origin - self.origin;
+ d = inflictor.origin - this.origin;
if (d)
f = (d * v_right) / vlen(d); // this is cos of angle of d and v_right!
else
f = 0; // Assum ecenter.
force = v_right * vlen(force);
- Violence_GibSplash_At(ear1, force * -1, 2, bound(0, damage, 25) / 2 * (0.5 - 0.5 * f), self, attacker);
- Violence_GibSplash_At(ear2, force, 2, bound(0, damage, 25) / 2 * (0.5 + 0.5 * f), self, attacker);
+ Violence_GibSplash_At(ear1, force * -1, 2, bound(0, damage, 25) / 2 * (0.5 - 0.5 * f), this, attacker);
+ Violence_GibSplash_At(ear2, force, 2, bound(0, damage, 25) / 2 * (0.5 + 0.5 * f), this, attacker);
if(f > 0)
{
hitloc = ear1;
}
}
else
- Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
+ Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
- v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
+ v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
take = v.x;
save = v.y;
- if(attacker == self)
+ if(attacker == this)
{
- // don't reset pushltime for self damage as it may be an attempt to
+ // don't reset pushltime for this damage as it may be an attempt to
// escape a lava pit or similar
- //self.pushltime = 0;
- self.istypefrag = 0;
+ //this.pushltime = 0;
+ this.istypefrag = 0;
}
else if(IS_PLAYER(attacker))
{
- self.pusher = attacker;
- self.pushltime = time + autocvar_g_maxpushtime;
- self.istypefrag = self.BUTTON_CHAT;
+ this.pusher = attacker;
+ this.pushltime = time + autocvar_g_maxpushtime;
+ this.istypefrag = this.BUTTON_CHAT;
}
- else if(time < self.pushltime)
+ else if(time < this.pushltime)
{
- attacker = self.pusher;
- self.pushltime = max(self.pushltime, time + 0.6);
+ attacker = this.pusher;
+ this.pushltime = max(this.pushltime, time + 0.6);
}
else
{
- self.pushltime = 0;
- self.istypefrag = 0;
+ this.pushltime = 0;
+ this.istypefrag = 0;
}
frag_damage = damage;
- MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, self, force, take, save);
- take = bound(0, damage_take, self.health);
- save = bound(0, damage_save, self.armorvalue);
+ MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, this, force, take, save);
+ take = bound(0, damage_take, this.health);
+ save = bound(0, damage_save, this.armorvalue);
excess = max(0, damage - take - save);
if(sound_allowed(MSG_BROADCAST, attacker))
{
if (save > 10)
- sound (self, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM);
+ sound (this, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM);
else if (take > 30)
- sound (self, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM);
+ sound (this, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM);
else if (take > 10)
- sound (self, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); // FIXME possibly remove them?
+ sound (this, CH_SHOTS, SND_BODYIMPACT1, VOL_BASE, ATTEN_NORM); // FIXME possibly remove them?
}
if (take > 50)
- Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, self, attacker);
+ Violence_GibSplash_At(hitloc, force * -0.1, 3, 1, this, attacker);
if (take > 100)
- Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, self, attacker);
+ Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
- if (time >= self.spawnshieldtime)
+ if (time >= this.spawnshieldtime)
{
- if (!(self.flags & FL_GODMODE))
+ if (!(this.flags & FL_GODMODE))
{
- self.armorvalue = self.armorvalue - save;
- self.health = self.health - take;
+ this.armorvalue = this.armorvalue - save;
+ this.health = this.health - take;
// pause regeneration for 5 seconds
if(take)
- self.pauseregen_finished = max(self.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
+ this.pauseregen_finished = max(this.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
- if (time > self.pain_finished) //Don't switch pain sequences like crazy
+ if (time > this.pain_finished) //Don't switch pain sequences like crazy
{
- self.pain_finished = time + 0.5; //Supajoe
+ this.pain_finished = time + 0.5; //Supajoe
if(autocvar_sv_gentle < 1) {
- if(self.classname != "body") // pain anim is BORKED on our ZYMs, FIXME remove this once we have good models
+ if(this.classname != "body") // pain anim is BORKED on our ZYMs, FIXME remove this once we have good models
{
- if (!self.animstate_override)
+ if (!this.animstate_override)
{
if (random() > 0.5)
- animdecide_setaction(self, ANIMACTION_PAIN1, true);
+ animdecide_setaction(this, ANIMACTION_PAIN1, true);
else
- animdecide_setaction(self, ANIMACTION_PAIN2, true);
+ animdecide_setaction(this, ANIMACTION_PAIN2, true);
}
}
if(sound_allowed(MSG_BROADCAST, attacker))
- if((self.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || attacker != self) // WEAPONTODO: create separate limit for pain notification with laser
- if(self.health > 1)
+ if((this.health < 2 * WEP_CVAR_PRI(blaster, damage) * autocvar_g_balance_selfdamagepercent + 1) || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || attacker != this) // WEAPONTODO: create separate limit for pain notification with laser
+ if(this.health > 1)
// exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two
{
if(deathtype == DEATH_FALL.m_id)
- PlayerSound(self, playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND);
- else if(self.health > 75) // TODO make a "gentle" version?
- PlayerSound(self, playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND);
- else if(self.health > 50)
- PlayerSound(self, playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND);
- else if(self.health > 25)
- PlayerSound(self, playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ else if(this.health > 75) // TODO make a "gentle" version?
+ PlayerSound(this, playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ else if(this.health > 50)
+ PlayerSound(this, playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ else if(this.health > 25)
+ PlayerSound(this, playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND);
else
- PlayerSound(self, playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND);
}
}
}
// throw off bot aim temporarily
float shake;
- if(IS_BOT_CLIENT(self) && self.health >= 1)
+ if(IS_BOT_CLIENT(this) && this.health >= 1)
{
shake = damage * 5 / (bound(0,skill,100) + 1);
- self.v_angle_x = self.v_angle.x + (random() * 2 - 1) * shake;
- self.v_angle_y = self.v_angle.y + (random() * 2 - 1) * shake;
- self.v_angle_x = bound(-90, self.v_angle.x, 90);
+ this.v_angle_x = this.v_angle.x + (random() * 2 - 1) * shake;
+ this.v_angle_y = this.v_angle.y + (random() * 2 - 1) * shake;
+ this.v_angle_x = bound(-90, this.v_angle.x, 90);
}
}
else
- self.max_armorvalue += (save + take);
+ this.max_armorvalue += (save + take);
}
- self.dmg_save = self.dmg_save + save;//max(save - 10, 0);
- self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
- self.dmg_inflictor = inflictor;
+ this.dmg_save = this.dmg_save + save;//max(save - 10, 0);
+ this.dmg_take = this.dmg_take + take;//max(take - 10, 0);
+ this.dmg_inflictor = inflictor;
- if (self != attacker) {
+ if (this != attacker) {
float realdmg = damage - excess;
if (IS_PLAYER(attacker)) {
PlayerScore_Add(attacker, SP_DMG, realdmg);
}
- if (IS_PLAYER(self)) {
- PlayerScore_Add(self, SP_DMGTAKEN, realdmg);
+ if (IS_PLAYER(this)) {
+ PlayerScore_Add(this, SP_DMGTAKEN, realdmg);
}
}
bool abot = (IS_BOT_CLIENT(attacker));
- bool vbot = (IS_BOT_CLIENT(self));
+ bool vbot = (IS_BOT_CLIENT(this));
valid_damage_for_weaponstats = 0;
Weapon awep = WEP_Null;
- if(vbot || IS_REAL_CLIENT(self))
+ if(vbot || IS_REAL_CLIENT(this))
if(abot || IS_REAL_CLIENT(attacker))
- if(attacker && self != attacker)
- if(DIFF_TEAM(self, attacker))
+ if(attacker && this != attacker)
+ if(DIFF_TEAM(this, attacker))
{
if(DEATH_ISSPECIAL(deathtype))
awep = PS(attacker).m_weapon;
if(valid_damage_for_weaponstats)
{
- dh = dh - max(self.health, 0);
- da = da - max(self.armorvalue, 0);
- WeaponStats_LogDamage(awep.m_id, abot, PS(self).m_weapon.m_id, vbot, dh + da);
- MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc, deathtype);
+ dh = dh - max(this.health, 0);
+ da = da - max(this.armorvalue, 0);
+ WeaponStats_LogDamage(awep.m_id, abot, PS(this).m_weapon.m_id, vbot, dh + da);
+ MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype);
}
- if (self.health < 1)
+ if (this.health < 1)
{
float defer_ClientKill_Now_TeamChange;
defer_ClientKill_Now_TeamChange = false;
- if(self.alivetime)
+ if(this.alivetime)
{
- PS_GR_P_ADDVAL(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
- self.alivetime = 0;
+ PS_GR_P_ADDVAL(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
+ this.alivetime = 0;
}
if(valid_damage_for_weaponstats)
- WeaponStats_LogKill(awep.m_id, abot, PS(self).m_weapon.m_id, vbot);
+ WeaponStats_LogKill(awep.m_id, abot, PS(this).m_weapon.m_id, vbot);
if(autocvar_sv_gentle < 1) // TODO make a "gentle" version?
if(sound_allowed(MSG_BROADCAST, attacker))
{
if(deathtype == DEATH_DROWN.m_id)
- PlayerSound(self, playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND);
else
- PlayerSound(self, playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND);
}
// get rid of kill indicator
- if(self.killindicator)
+ if(this.killindicator)
{
- remove(self.killindicator);
- self.killindicator = world;
- if(self.killindicator_teamchange)
+ remove(this.killindicator);
+ this.killindicator = world;
+ if(this.killindicator_teamchange)
defer_ClientKill_Now_TeamChange = true;
- if(self.classname == "body")
+ if(this.classname == "body")
if(deathtype == DEATH_KILL.m_id)
{
// for the lemmings fans, a small harmless explosion
- Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
+ Send_Effect(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
}
}
// print an obituary message
- if(self.classname != "body")
- Obituary (attacker, inflictor, self, deathtype);
+ if(this.classname != "body")
+ Obituary (attacker, inflictor, this, deathtype);
// increment frag counter for used weapon type
Weapon w = DEATH_WEAPONOF(deathtype);
if(w != WEP_Null)
- if(accuracy_isgooddamage(attacker, self))
+ if(accuracy_isgooddamage(attacker, this))
attacker.accuracy.(accuracy_frags[w.m_id-1]) += 1;
- MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
+ MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, this, deathtype);
excess = frag_damage;
- Weapon wep = PS(self).m_weapon;
- wep.wr_playerdeath(wep);
+ Weapon wep = PS(this).m_weapon;
+ WITH(entity, self, this, wep.wr_playerdeath(wep));
- RemoveGrapplingHook(self);
+ RemoveGrapplingHook(this);
- Portal_ClearAllLater(self);
+ Portal_ClearAllLater(this);
- self.fixangle = true;
+ this.fixangle = true;
if(defer_ClientKill_Now_TeamChange)
- ClientKill_Now_TeamChange(); // can turn player into spectator
+ ClientKill_Now_TeamChange(this); // can turn player into spectator
// player could have been miraculously resuscitated ;)
// e.g. players in freezetag get frozen, they don't really die
- if(self.health >= 1 || !(IS_PLAYER(self) || self.classname == "body"))
+ if(this.health >= 1 || !(IS_PLAYER(this) || this.classname == "body"))
return;
// when we get here, player actually dies
- Unfreeze(self); // remove any icy remains
- self.health = 0; // Unfreeze resets health, so we need to set it back
+ Unfreeze(this); // remove any icy remains
+ this.health = 0; // Unfreeze resets health, so we need to set it back
// clear waypoints
- WaypointSprite_PlayerDead();
+ WaypointSprite_PlayerDead(this);
// throw a weapon
- SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, PS(self).m_switchweapon.m_id);
+ SpawnThrownWeapon(this, this.origin + (this.mins + this.maxs) * 0.5, PS(this).m_switchweapon.m_id);
// become fully visible
- self.alpha = default_player_alpha;
+ this.alpha = default_player_alpha;
// make the corpse upright (not tilted)
- self.angles_x = 0;
- self.angles_z = 0;
+ this.angles_x = 0;
+ this.angles_z = 0;
// don't spin
- self.avelocity = '0 0 0';
+ this.avelocity = '0 0 0';
// view from the floor
- self.view_ofs = '0 0 -8';
+ this.view_ofs = '0 0 -8';
// toss the corpse
- self.movetype = MOVETYPE_TOSS;
+ this.movetype = MOVETYPE_TOSS;
// shootable corpse
- self.solid = SOLID_CORPSE;
- self.ballistics_density = autocvar_g_ballistics_density_corpse;
+ this.solid = SOLID_CORPSE;
+ this.ballistics_density = autocvar_g_ballistics_density_corpse;
// don't stick to the floor
- UNSET_ONGROUND(self);
+ UNSET_ONGROUND(this);
// dying animation
- self.deadflag = DEAD_DYING;
+ this.deadflag = DEAD_DYING;
// when to allow respawn
calculate_player_respawn_time(this);
- self.death_time = time;
+ this.death_time = time;
if (random() < 0.5)
- animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD1, true);
+ animdecide_setstate(this, this.anim_state | ANIMSTATE_DEAD1, true);
else
- animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD2, true);
- if (self.maxs.z > 5)
+ animdecide_setstate(this, this.anim_state | ANIMSTATE_DEAD2, true);
+ if (this.maxs.z > 5)
{
- self.maxs_z = 5;
- setsize(self, self.mins, self.maxs);
+ this.maxs_z = 5;
+ setsize(this, this.mins, this.maxs);
}
// set damage function to corpse damage
- self.event_damage = PlayerCorpseDamage;
+ this.event_damage = PlayerCorpseDamage;
// call the corpse damage function just in case it wants to gib
- self.event_damage(inflictor, attacker, excess, deathtype, hitloc, force);
+ this.event_damage(this, inflictor, attacker, excess, deathtype, hitloc, force);
// set up to fade out later
- SUB_SetFade (self, time + 6 + random (), 1);
+ SUB_SetFade (this, time + 6 + random (), 1);
// reset body think wrapper broken by SUB_SetFade
- if(self.classname == "body" && self.think != CopyBody_Think) {
- self.CopyBody_think = self.think;
- self.CopyBody_nextthink = self.nextthink;
- self.think = CopyBody_Think;
- self.nextthink = time;
+ if(this.classname == "body" && this.think != CopyBody_Think) {
+ this.CopyBody_think = this.think;
+ this.CopyBody_nextthink = this.nextthink;
+ this.think = CopyBody_Think;
+ this.nextthink = time;
}
- if(autocvar_sv_gentle > 0 || autocvar_ekg || self.classname == "body") {
+ if(autocvar_sv_gentle > 0 || autocvar_ekg || this.classname == "body") {
// remove corpse
// clones don't run any animation code any more, so we must gib them when they die :(
- PlayerCorpseDamage (inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force);
+ PlayerCorpseDamage(this, inflictor, attacker, autocvar_sv_gibhealth+1.0, deathtype, hitloc, force);
}
// reset fields the weapons may use just in case
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- it.wr_resetplayer(it);
+ WITH(entity, self, this, it.wr_resetplayer(it));
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
- ATTACK_FINISHED_FOR(self, it.m_id, slot) = 0;
+ ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
}
));
}
void player_anim();
-void PlayerCorpseDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
// g_<gametype>_str:
// If 0, default is used.
void calculate_player_respawn_time(entity this);
-void ClientKill_Now_TeamChange();
+void ClientKill_Now_TeamChange(entity this);
void MoveToTeam(entity client, float team_colour, float type);
-void PlayerDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
+void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
/** to be used by `prvm_edictset server playernumber muted 1` */
.float muted;
// Fields
-.void(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
+.void(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
//.string wad;
//.string map;
// apply damage
if (damage != 0 || (self.damageforcescale && vlen(force)))
if (self.event_damage)
- self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
+ self.event_damage (self, inflictor, attacker, damage, deathtype, hitloc, force);
setself(this);
// apply mirror damage if any
//self.realowner.disableclientprediction = true;
}
-void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.health <= 0)
+void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.health <= 0)
return;
- if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
+ if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_balance_projectiledamage says to halt
- self.health = self.health - damage;
+ this.health = this.health - damage;
- if (self.health <= 0)
+ if (this.health <= 0)
{
- if(attacker != self.realowner)
+ if(attacker != this.realowner)
{
- self.realowner.pusher = attacker;
- self.realowner.pushltime = time + autocvar_g_maxpushtime;
- self.realowner.istypefrag = self.realowner.BUTTON_CHAT;
+ this.realowner.pusher = attacker;
+ this.realowner.pushltime = time + autocvar_g_maxpushtime;
+ this.realowner.istypefrag = this.realowner.BUTTON_CHAT;
}
- RemoveGrapplingHook(self.realowner);
+ RemoveGrapplingHook(this.realowner);
}
}
/** called when a monster dies */
#define EV_MonsterDies(i, o) \
+ /**/ i(entity, frag_target) \
/**/ i(entity, frag_attacker) \
/**/
MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
}
}
-void ctf_FlagDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
if(autocvar_g_ctf_flag_return_damage_delay)
{
- self.ctf_flagdamaged = true;
+ this.ctf_flagdamaged = true;
}
else
{
- self.health = 0;
- ctf_CheckFlagReturn(self, RETURN_NEEDKILL);
+ this.health = 0;
+ ctf_CheckFlagReturn(this, RETURN_NEEDKILL);
}
return;
}
if(autocvar_g_ctf_flag_return_damage)
{
// reduce health and check if it should be returned
- self.health = self.health - damage;
- ctf_CheckFlagReturn(self, RETURN_DAMAGE);
+ this.health = this.health - damage;
+ ctf_CheckFlagReturn(this, RETURN_DAMAGE);
return;
}
}
}
MUTATOR_HOOKFUNCTION(inv, MonsterDies)
-{SELFPARAM();
- if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
+{
+ if(!(frag_target.spawnflags & MONSTERFLAG_RESPAWNED))
{
inv_numkilled += 1;
inv_maxcurrent -= 1;
- if(teamplay) { inv_monsters_perteam[self.team] -= 1; }
+ if(teamplay) { inv_monsters_perteam[frag_target.team] -= 1; }
if(IS_PLAYER(frag_attacker))
- if(SAME_TEAM(frag_attacker, self)) // in non-teamplay modes, same team = same player, so this works
+ if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works
PlayerScore_Add(frag_attacker, SP_KILLS, -1);
else
{
}
}
-void kh_Key_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
- if(self.owner)
+void kh_Key_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
+ if(this.owner)
return;
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
}
if(vlen(force) <= 0)
return;
- if(time > self.pushltime)
+ if(time > this.pushltime)
if(IS_PLAYER(attacker))
- self.team = attacker.team;
+ this.team = attacker.team;
}
void kh_Key_Collect(entity key, entity player) //a player picks up a dropped key
}
}
-void Portal_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{SELFPARAM();
+void Portal_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+{
if(deathtype == DEATH_TELEFRAG.m_id)
return;
- if(attacker != self.aiment)
- if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(self.aiment))
+ if(attacker != this.aiment)
+ if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(this.aiment))
return;
- self.health -= damage;
- if(self.health < 0)
- Portal_Remove(self, 1);
+ this.health -= damage;
+ if(this.health < 0)
+ Portal_Remove(this, 1);
}
void Portal_Think_TryTeleportPlayer(entity e, vector g)
Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id);
}
-void SpawnThrownWeapon(vector org, float w)
-{SELFPARAM();
- if(self.weapons & WepSet_FromWeapon(PS(self).m_weapon))
- if(W_IsWeaponThrowable(PS(self).m_weapon.m_id))
- W_ThrowNewWeapon(self, PS(self).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
+void SpawnThrownWeapon(entity this, vector org, float w)
+{
+ if(this.weapons & WepSet_FromWeapon(PS(this).m_weapon))
+ if(W_IsWeaponThrowable(PS(this).m_weapon.m_id))
+ W_ThrowNewWeapon(this, PS(this).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
}
// toss current weapon
void W_ThrowWeapon(vector velo, vector delta, float doreduce);
-void SpawnThrownWeapon(vector org, float w);
+void SpawnThrownWeapon(entity this, vector org, float w);
#endif