From: terencehill Date: Thu, 27 May 2021 22:28:45 +0000 (+0200) Subject: Count damage caused by suicide (with the kill command) as damage taken except in... X-Git-Tag: xonotic-v0.8.5~405^2~22^2~2 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=c8411b61c6dd7b1bd1204a2d090308d38da058df;p=xonotic%2Fxonotic-data.pk3dir.git Count damage caused by suicide (with the kill command) as damage taken except in game modes where suicide is for respawning (race, cts) --- diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc index 7e052de04..83252c00d 100644 --- a/qcsrc/server/damage.qc +++ b/qcsrc/server/damage.qc @@ -611,9 +611,12 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de // These are ALWAYS lethal // No damage modification here // Instead, prepare the victim for his death... - SetResourceExplicit(targ, RES_ARMOR, 0); + if(deathtype == DEATH_TEAMCHANGE.m_id || deathtype == DEATH_AUTOTEAMCHANGE.m_id) + { + SetResourceExplicit(targ, RES_ARMOR, 0); + SetResourceExplicit(targ, RES_HEALTH, 0.9); // this is < 1 + } targ.spawnshieldtime = 0; - SetResourceExplicit(targ, RES_HEALTH, 0.9); // this is < 1 targ.flags -= targ.flags & FL_GODMODE; damage = 100000; } diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 0a7dd86cb..bd1bc6d68 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -389,12 +389,15 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, } float realdmg = damage - excess; - if (this != attacker && realdmg && !STAT(FROZEN, this) + if ((this != attacker || deathtype == DEATH_KILL.m_id) && realdmg && !STAT(FROZEN, this) && (!(round_handler_IsActive() && !round_handler_IsRoundStarted()) && time >= game_starttime)) { - if (IS_PLAYER(attacker) && DIFF_TEAM(attacker, this)) { + if (IS_PLAYER(attacker) && DIFF_TEAM(attacker, this) && deathtype != DEATH_KILL.m_id) { GameRules_scoring_add(attacker, DMG, realdmg); } + // don't count DEATH_KILL damage in game modes where suicide is for respawning + // TODO mutator hook? + if (deathtype != DEATH_KILL.m_id || !(IS_GAMETYPE(RACE) || IS_GAMETYPE(CTS))) if (IS_PLAYER(this)) { GameRules_scoring_add(this, DMGTAKEN, realdmg); }