else
player.alpha = player.nade_veil_prevalpha;
}
+ //LegendGuard adds nade if STAT DARK_ORB 08-02-2021
+ if(STAT(DARK_ORB, player) && STAT(DARK_ORB, player) <= time)
+ {
+ STAT(DARK_ORB, player) = 0;
+ if(player.vehicle)
+ player.vehicle.alpha = player.vehicle.nade_dark_prevalpha;
+ else
+ player.alpha = player.nade_dark_prevalpha;
+ }
}
- if (frametime && IS_PLAYER(player))
- {
- int n = 0;
+ if (!(frametime && IS_PLAYER(player)))
+ return true;
- IntrusiveList reviving_players = NULL;
+ entity revivers_last = NULL;
+ entity revivers_first = NULL;
- if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
- n = -1;
- else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING)
+ bool player_is_reviving = false;
+ int n = 0;
+ vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
+ 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)
{
- vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
- n = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), {
- if (!reviving_players)
- reviving_players = IL_NEW();
- IL_PUSH(reviving_players, it);
- ++n;
- });
+ if ((STAT(FROZEN, player) == FROZEN_TEMP_DYING))
+ continue;
+ if (!IN_REVIVING_RANGE(player, it, revive_extra_size))
+ continue;
+ player_is_reviving = true;
+ break;
}
- 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);
- SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+ if (!(STAT(FROZEN, player) == FROZEN_TEMP_DYING))
+ continue; // both player and it are NOT frozen
+ if (revivers_last)
+ revivers_last.chain = it;
+ revivers_last = it;
+ if (!revivers_first)
+ revivers_first = it;
+ ++n;
+ });
+ if (revivers_last)
+ revivers_last.chain = NULL;
- if(STAT(REVIVE_PROGRESS, player) >= 1)
- {
- Unfreeze(player, false);
+ 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
+ STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * player.revive_speed, 1);
+ SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
- entity first = IL_FIRST(reviving_players);
- Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname);
- Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
- }
+ if(STAT(REVIVE_PROGRESS, player) >= 1)
+ {
+ Unfreeze(player, false);
- IL_EACH(reviving_players, true, {
- STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
- });
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, revivers_first.netname);
+ Send_Notification(NOTIF_ONE, revivers_first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
}
- if (reviving_players)
- IL_DELETE(reviving_players);
+
+ for(entity it = revivers_first; it; it = it.chain)
+ STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
}
}