From f07cd790bb79d2ce08fd50a5f3eafbd3d74e6213 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 12 Jun 2020 23:38:54 +0200 Subject: [PATCH] Show autorevival progress of frozen players as waypoint health bar rather than normal health bar, which is barely visible for red players --- gamemodes-server.cfg | 2 +- .../gamemodes/gamemode/freezetag/sv_freezetag.qc | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index fba19aaba..9a47eea2e 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -374,7 +374,7 @@ set g_freezetag_revive_nade_health 40 "Amount of health player has if they reviv set g_freezetag_round_timelimit 360 "round time limit in seconds" set g_freezetag_revive_auto 1 "automatically revive frozen players after some time (g_freezetag_frozen_maxtime)" set g_freezetag_revive_auto_progress 1 "start the automatic reviving progress as soon as the player gets frozen" -set g_freezetag_revive_auto_reducible 1 "reduce auto-revival time when frozen players are hit by enemies; if cvar value is negative reduce time even when they are hit by teammates" +set g_freezetag_revive_auto_reducible 1 "reduce auto-revival time when frozen players are hit by enemies; set to -1 to reduce it even when they are hit by teammates" set g_freezetag_revive_auto_reducible_forcefactor 0.025 "hit force to time reduction conversion factor" set g_freezetag_frozen_maxtime 60 "frozen players will be automatically unfrozen after this time in seconds" set g_freezetag_teams_override 0 diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index 2a931fa97..98b20f32a 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -540,22 +540,19 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) if (!n) // no teammate nearby { if (STAT(FROZEN, player) == FROZEN_NORMAL) - { STAT(REVIVE_PROGRESS, player) = bound(base_progress, STAT(REVIVE_PROGRESS, player) - frametime * autocvar_g_freezetag_revive_clearspeed * (1 - base_progress), 1); - SetResourceExplicit(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health))); - } else if (!STAT(FROZEN, player)) STAT(REVIVE_PROGRESS, player) = base_progress; // thawing nobody } else if (STAT(FROZEN, player) == FROZEN_NORMAL) // OK, there is at least one teammate reviving us { STAT(REVIVE_PROGRESS, player) = bound(base_progress, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed * (1 - base_progress)), 1); - SetResourceExplicit(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health))); if(STAT(REVIVE_PROGRESS, player) >= 1) { float frozen_time = time - player.freezetag_frozen_time; Unfreeze(player, false); + SetResourceExplicit(player, RES_HEALTH, ((warmup_stage) ? warmup_start_health : start_health)); freezetag_count_alive_players(); if(n == -1) @@ -583,6 +580,12 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player); } + if (STAT(FROZEN, player) == FROZEN_NORMAL) + { + WaypointSprite_UpdateMaxHealth(player.waypointsprite_attached, 1); + WaypointSprite_UpdateHealth(player.waypointsprite_attached, STAT(REVIVE_PROGRESS, player)); + } + return true; } -- 2.39.2