From: Martin Taibr Date: Sun, 18 Feb 2018 10:51:43 +0000 (+0100) Subject: Merge branch 'master' into martin-t/rpc-acc X-Git-Tag: xonotic-v0.8.5~1964^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=26d2cece1d88a2fad9e0a2f8069c3924496698c1;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into martin-t/rpc-acc --- 26d2cece1d88a2fad9e0a2f8069c3924496698c1 diff --cc qcsrc/common/mutators/mutator/overkill/rpc.qc index f331e6822,09e6ce29e..643cfd4e3 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@@ -9,12 -7,7 +9,12 @@@ void W_RocketPropelledChainsaw_Explode( this.event_damage = func_null; this.takedamage = DAMAGE_NO; - float explosion_damage = RadiusDamage(this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, directhitentity); - RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity); ++ float explosion_damage = RadiusDamage(this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, 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(rpc, damage), 0); + } delete(this); } @@@ -60,17 -53,8 +60,17 @@@ void W_RocketPropelledChainsaw_Think(en 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)) - Damage (trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force)); + 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 (WEP_CVAR(rpc, damage)) 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%. + accuracy_add(this.realowner, DEATH_WEAPONOF(this.projectiledeathtype).m_id, WEP_CVAR(rpc, damage2) - WEP_CVAR(rpc, damage), WEP_CVAR(rpc, damage2)); + } + this.m_chainsaw_damage += WEP_CVAR(rpc, damage2); + } - Damage(trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force)); ++ Damage(trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR(rpc, force)); + } this.velocity = mydir * (myspeed + (WEP_CVAR(rpc, speedaccel) * sys_frametime)); @@@ -84,7 -68,7 +84,7 @@@ void W_RocketPropelledChainsaw_Attack(W entity flash = spawn (); W_DecreaseAmmo(thiswep, actor, WEP_CVAR(rpc, ammo), weaponentity); - W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage)); - W_SetupShot_ProjectileSize (actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage), WEP_RPC.m_id); ++ W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage), WEP_RPC.m_id); Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); PROJECTILE_MAKETRIGGER(missile); diff --cc qcsrc/server/g_damage.qc index 5f04185ed,804d9fd71..33dd8b2e2 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@@ -32,7 -32,7 +32,7 @@@ void UpdateFrags(entity player, int f GameRules_scoring_add_team(player, SCORE, f); } - void GiveFrags(entity attacker, entity targ, float f, int deathtype) -void GiveFrags (entity attacker, entity targ, float f, int deathtype, .entity weaponentity) ++void GiveFrags(entity attacker, entity targ, float f, int deathtype, .entity weaponentity) { // TODO route through PlayerScores instead if(game_stopped) return; @@@ -607,7 -604,7 +604,7 @@@ void Unfreeze(entity targ targ.iceblock = NULL; } - void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) ++void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { float complainteamdamage = 0; float mirrordamage = 0; @@@ -909,7 -906,8 +906,8 @@@ } } - float RadiusDamageForSource(entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, int deathtype, entity directhitentity) -float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, ++float RadiusDamageForSource(entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, + float inflictorselfdamage, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity) // Returns total damage applies to creatures { entity targ; @@@ -1080,9 -1078,9 +1078,9 @@@ } if(targ == directhitentity || DEATH_ISSPECIAL(deathtype)) - Damage(targ, inflictor, attacker, finaldmg, deathtype, nearest, force); - Damage (targ, inflictor, attacker, finaldmg, deathtype, weaponentity, nearest, force); ++ Damage(targ, inflictor, attacker, finaldmg, deathtype, weaponentity, nearest, force); else - Damage(targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, nearest, force); - Damage (targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, weaponentity, nearest, force); ++ Damage(targ, inflictor, attacker, finaldmg, deathtype | HITTYPE_SPLASH, weaponentity, nearest, force); } } } @@@ -1098,9 -1096,9 +1096,9 @@@ return total_damage_to_creatures; } - float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, entity directhitentity) -float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity) ++float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity) { - return RadiusDamageForSource(inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, directhitentity); - return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, weaponentity, directhitentity); ++ return RadiusDamageForSource(inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, weaponentity, directhitentity); } float Fire_IsBurning(entity e)