#ifdef SVQC
+.float m_chainsaw_damage; // accumulated damage of the missile as it passes trough enemies
+
void W_OverkillRocketPropelledChainsaw_Explode(entity this, entity directhitentity)
{
this.event_damage = func_null;
this.takedamage = DAMAGE_NO;
- RadiusDamage(this, this.realowner, WEP_CVAR_PRI(okrpc, damage), WEP_CVAR_PRI(okrpc, edgedamage), WEP_CVAR_PRI(okrpc, radius), NULL, NULL, WEP_CVAR_PRI(okrpc, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
+ float explosion_damage = RadiusDamage(this, this.realowner, WEP_CVAR_PRI(okrpc, damage), WEP_CVAR_PRI(okrpc, edgedamage), WEP_CVAR_PRI(okrpc, radius), NULL, NULL, WEP_CVAR_PRI(okrpc, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
+ if (explosion_damage > 0 && this.m_chainsaw_damage > 0)
+ {
+ // if chainsaw hit something, it removed fired damage (so that direct hit is 100%)
+ // now that we also damaged something by explosion we'd go over 100% so let's add the fired damage back
+ accuracy_add(this.realowner, DEATH_WEAPONOF(this.projectiledeathtype).m_id, WEP_CVAR(okrpc, damage), 0);
+ }
delete(this);
}
vector mydir = normalize(this.velocity);
tracebox(this.origin, this.mins, this.maxs, this.origin + mydir * (2 * myspeed_accel), MOVE_NORMAL, this);
- if(IS_PLAYER(trace_ent))
+ if (IS_PLAYER(trace_ent))
+ {
+ if (accuracy_isgooddamage(this.realowner, trace_ent))
+ {
+ if (this.m_chainsaw_damage == 0) // first hit
+ {
+ // The fired damage of the explosion is already counted in the statistics (when launching the chainsaw).
+ // We remove it here so that a direct hit that passes through and doesn't damage anything by the explosion later is still 100%.
+ float fired_damage = WEP_CVAR_PRI(okrpc, damage2) - WEP_CVAR_PRI(okrpc, damage);
+ float hit_damage = WEP_CVAR_PRI(okrpc, damage2);
+ accuracy_add(this.realowner, DEATH_WEAPONOF(this.projectiledeathtype).m_id, fired_damage, hit_damage);
+ }
+ this.m_chainsaw_damage += WEP_CVAR_PRI(okrpc, damage2);
+ }
Damage(trace_ent, this, this.realowner, WEP_CVAR_PRI(okrpc, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR_PRI(okrpc, force));
+ }
this.velocity = mydir * (myspeed + (WEP_CVAR_PRI(okrpc, speedaccel) * sys_frametime));
SUB_SetFade (flash, time, 0.1);
flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
W_AttachToShotorg(actor, weaponentity, flash, '5 0 0');
+ missile.m_chainsaw_damage = 0;
MUTATOR_CALLHOOK(EditProjectile, actor, missile);
}