From: terencehill Date: Sun, 11 Apr 2021 21:54:20 +0000 (+0200) Subject: Fix circular bar stuck on screen when stopping a revival of a player frozen by an... X-Git-Tag: xonotic-v0.8.5~449^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=42d7440ca041a356f5014945cdb85b4be853eebe;p=xonotic%2Fxonotic-data.pk3dir.git Fix circular bar stuck on screen when stopping a revival of a player frozen by an ice nade --- diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index a75a00804..51e6981e6 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1348,25 +1348,40 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) entity revivers_last = NULL; entity revivers_first = NULL; - if (STAT(FROZEN, player) == FROZEN_TEMP_DYING) - { - vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; - n = 0; - FOREACH_CLIENT(IS_PLAYER(it) && IN_REVIVING_RANGE(player, it, revive_extra_size), { - if (STAT(FROZEN, it)) + bool player_is_reviving = false; + vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; + n = 0; + FOREACH_CLIENT(IS_PLAYER(it) && IN_REVIVING_RANGE(player, it, revive_extra_size), { + // check if player is reviving anyone + if (STAT(FROZEN, it) == FROZEN_TEMP_DYING) + { + if ((STAT(FROZEN, player) == FROZEN_TEMP_DYING)) + continue; + if (!IN_REVIVING_RANGE(player, it, revive_extra_size)) continue; - if (revivers_last) - revivers_last.chain = it; - revivers_last = it; - if (!revivers_first) - revivers_first = it; - ++n; - }); + player_is_reviving = true; + break; + } + + if (!(STAT(FROZEN, player) == FROZEN_TEMP_DYING)) + continue; // both player and it are NOT frozen if (revivers_last) - revivers_last.chain = NULL; - } + revivers_last.chain = it; + revivers_last = it; + if (!revivers_first) + revivers_first = it; + ++n; + }); + if (revivers_last) + revivers_last.chain = NULL; - if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us + if (!n) // no teammate nearby + { + // freezetag already resets revive progress + if (!g_freezetag && !STAT(FROZEN, player) && !player_is_reviving) + STAT(REVIVE_PROGRESS, player) = 0; // thawing nobody + } + else if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us { STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1); // undo what PlayerPreThink did