From: terencehill Date: Wed, 24 May 2023 22:52:41 +0000 (+0200) Subject: Also don't increase armor and ammo of non-frozen players falling into space too;... X-Git-Tag: xonotic-v0.8.6~62^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=04eacafe4c8856f2dd1f57aa856e441953901a90;p=xonotic%2Fxonotic-data.pk3dir.git Also don't increase armor and ammo of non-frozen players falling into space too; this commit together with the previous one fixes #2837 --- diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index 08d4935ae..3bb78272f 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -179,8 +179,6 @@ void freezetag_Freeze(entity targ, entity attacker) if(STAT(FROZEN, targ)) return; - targ.freezetag_frozen_armor = GetResource(targ, RES_ARMOR); - targ.freezetag_frozen_time = time; if (autocvar_g_freezetag_revive_auto && autocvar_g_freezetag_frozen_maxtime > 0) targ.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime; @@ -353,41 +351,38 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies) frag_target.respawn_time = time + 1; frag_target.respawn_flags |= RESPAWN_FORCE; - // Cases DEATH_TEAMCHANGE and DEATH_AUTOTEAMCHANGE are needed to fix a bug whe - // you succeed changing team through the menu: you both really die (gibbing) and get frozen - if(ITEM_DAMAGE_NEEDKILL(frag_deathtype) - || frag_deathtype == DEATH_TEAMCHANGE.m_id || frag_deathtype == DEATH_AUTOTEAMCHANGE.m_id) + // let the player die, they will be automatically frozen when they respawn + // it fixes a bug where you both really die (gibbing) and get frozen + // if you succeed changing team through the menu + if (frag_deathtype == DEATH_TEAMCHANGE.m_id || frag_deathtype == DEATH_AUTOTEAMCHANGE.m_id) { - // let the player die, they will be automatically frozen when they respawn - if (STAT(FROZEN, frag_target) != FROZEN_NORMAL) - { - freezetag_Add_Score(frag_target, frag_attacker); - freezetag_count_alive_players(); - freezetag_LastPlayerForTeam_Notify(frag_target); - frag_target.freezetag_frozen_timeout = -2; // freeze on respawn - } - else - { - // soft-kill: setting health to something >= 1 after death, ammo won't be reset - SetResourceExplicit(frag_target, RES_HEALTH, 1); - // restore armor as it was removed in PlayerDamage - SetResourceExplicit(frag_target, RES_ARMOR, frag_target.freezetag_frozen_armor); - - // relocate - entity spot = SelectSpawnPoint(frag_target, true); - setorigin(frag_target, spot.origin); - frag_target.oldorigin = frag_target.origin; - frag_target.fixangle = true; // turn this way immediately - frag_target.angles = vec2(spot.angles); - frag_target.velocity = '0 0 0'; - frag_target.oldvelocity = frag_target.velocity; // prevents fall damage, see CreatureFrame_FallDamage - frag_target.avelocity = '0 0 0'; - frag_target.punchangle = '0 0 0'; - frag_target.punchvector = '0 0 0'; - } + freezetag_Add_Score(frag_target, frag_attacker); + freezetag_count_alive_players(); + freezetag_LastPlayerForTeam_Notify(frag_target); + frag_target.freezetag_frozen_timeout = -2; // freeze on respawn return true; } + if(ITEM_DAMAGE_NEEDKILL(frag_deathtype)) + { + // soft-kill: setting health to something >= 1 after death, ammo won't be reset + SetResourceExplicit(frag_target, RES_HEALTH, 1); + // restore armor as it was removed in PlayerDamage + SetResourceExplicit(frag_target, RES_ARMOR, frag_target.freezetag_frozen_armor); + + // relocate + entity spot = SelectSpawnPoint(frag_target, true); + setorigin(frag_target, spot.origin); + frag_target.oldorigin = frag_target.origin; + frag_target.fixangle = true; // turn this way immediately + frag_target.angles = vec2(spot.angles); + frag_target.velocity = '0 0 0'; + frag_target.oldvelocity = frag_target.velocity; // prevents fall damage, see CreatureFrame_FallDamage + frag_target.avelocity = '0 0 0'; + frag_target.punchangle = '0 0 0'; + frag_target.punchvector = '0 0 0'; + } + if (STAT(FROZEN, frag_target) == FROZEN_NORMAL) return true; @@ -467,6 +462,8 @@ MUTATOR_HOOKFUNCTION(ft, Damage_Calculate) //float frag_damage = M_ARGV(4, float); vector frag_force = M_ARGV(6, vector); + frag_target.freezetag_frozen_armor = GetResource(frag_target, RES_ARMOR); + if (STAT(FROZEN, frag_target) == FROZEN_NORMAL && autocvar_g_freezetag_revive_auto_reducible && autocvar_g_freezetag_frozen_maxtime > 0 && autocvar_g_freezetag_revive_auto) {