}
HUD_Panel_DrawProgressBar(healthbarpos, healthbarsize, "progressbar",
defenderhealth, false, 0, healthbarcolor, 0.50, DRAWFLAG_NORMAL);
+ // Draw defender picture
+ int defenderteam = STAT(SURV_DEFENDER_TEAM);
+ string defenderpic = "";
+ vector defendercolor;
+ switch (defenderteam)
+ {
+ case 1:
+ {
+ defenderpic = "player_red";
+ defendercolor = '1 0 0';
+ break;
+ }
+ case 2:
+ {
+ defenderpic = "player_blue";
+ defendercolor = '0 0 1';
+ break;
+ }
+ default:
+ {
+ defendercolor = '1 1 1';
+ break;
+ }
+ }
+ vector picpos = mypos;
+ vector picsize = mysize;
+ picsize.x = picsize.y;
+ drawpic_aspect_skin(picpos, defenderpic, picsize, '1 1 1', 1,
+ DRAWFLAG_NORMAL);
+ // Draw number of defenders
+ int numalive = STAT(SURV_DEFENDERS_ALIVE);
+ vector alivepos = mypos;
+ alivepos.x += picsize.x;
+ vector alivesize = picsize;
+ drawstring_aspect(alivepos, ftos(numalive), alivesize, defendercolor, 1,
+ DRAWFLAG_NORMAL);
// Draw the time left
float roundtime = STAT(SURV_ROUND_TIME);
if (roundtime < 0)
{
roundtime = 0;
}
- drawstring_aspect(mypos, seconds_tostring(roundtime), mysize, '1 1 1', 1,
- DRAWFLAG_NORMAL);
-
+ vector roundtimepos = mypos;
+ roundtimepos.x += picsize.x * 2;
+ vector roundtimesize = mysize;
+ roundtimesize.x = mysize.x - picsize.x * 2;
+ drawstring_aspect(roundtimepos, seconds_tostring(roundtime), roundtimesize,
+ '1 1 1', 1, DRAWFLAG_NORMAL);
+ if (autocvar_developer == 0)
+ {
+ return;
+ }
+ // Debug info below
int redalive = STAT(REDALIVE);
int bluealive = STAT(BLUEALIVE);
int yellowalive = STAT(YELLOWALIVE);
/// \brief A stat that is used to track the time left in the round.
.float surv_round_time_stat = _STAT(SURV_ROUND_TIME);
+/// \brief A stat that is used to track defender team.
+.int surv_defender_team_stat = _STAT(SURV_DEFENDER_TEAM);
+/// \brief A stat that is used to track number of defenders alive.
+.int surv_defenders_alive_stat = _STAT(SURV_DEFENDERS_ALIVE);
/// \brief A stat that is used to track the total health of defenders.
.float surv_defender_health_stat = _STAT(SURV_DEFENDER_HEALTH);
int surv_attackercolor; ///< Holds the color of attackers.
int surv_defendercolor; ///< Holds the color of defenders.
-int surv_numattackers = 0; ///< Holds the number of players in attacker team.
-int surv_numdefenders = 0; ///< Holds the number of players in defender team.
+int surv_numattackers; ///< Holds the number of players in attacker team.
+int surv_numdefenders; ///< Holds the number of players in defender team.
/// \brief Holds the number of humans in attacker team.
-int surv_numattackerhumans = 0;
+int surv_numattackerhumans;
/// \brief Holds the number of humans in defender team.
-int surv_numdefenderhumans = 0;
+int surv_numdefenderhumans;
/// \brief Holds the number of attacker players that are alive.
-int surv_numattackersalive = 0;
+int surv_numattackersalive;
/// \brief Holds the number of defender players that are alive.
-int surv_numdefendersalive = 0;
+int surv_numdefendersalive;
-bool surv_autobalance = true; ///< Holds whether autobalance is active.
+bool surv_autobalance; ///< Holds whether autobalance is active.
bool surv_allowed_to_spawn; ///< Holds whether players are allowed to spawn.
//====================== Forward declarations =================================
surv_attackercolor = SURVIVAL_COLOR_BLUE;
surv_defendercolor = SURVIVAL_COLOR_RED;
}
+ surv_numattackers = 0;
+ surv_numdefenders = 0;
+ surv_numattackerhumans = 0;
+ surv_numdefenderhumans = 0;
+ surv_numattackersalive = 0;
+ surv_numdefendersalive = 0;
+ surv_autobalance = true;
surv_allowed_to_spawn = true;
precache_all_playermodels("models/ok_player/*.dpm");
WEP_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
/// \return No return.
void Surv_UpdateAliveStats()
{
+ // Debug stuff
if (surv_attackercolor == SURVIVAL_COLOR_RED)
{
redalive = surv_numattackersalive;
bluealive = surv_numdefendersalive;
- // Debug stuff
yellowalive = surv_numattackers;
pinkalive = surv_numdefenders;
}
{
bluealive = surv_numattackersalive;
redalive = surv_numdefendersalive;
- // Debug stuff
pinkalive = surv_numattackers;
yellowalive = surv_numdefenders;
}
FOREACH_CLIENT(IS_REAL_CLIENT(it),
{
+ it.surv_defenders_alive_stat = surv_numdefendersalive;
it.redalive_stat = redalive;
it.bluealive_stat = bluealive;
it.yellowalive_stat = yellowalive;
}
}
});
+ FOREACH_CLIENT(IS_REAL_CLIENT(it),
+ {
+ it.surv_defender_team_stat = Team_TeamToNumber(surv_defenderteam);
+ });
}
/// \brief Gives player shells.
entity player = M_ARGV(0, entity);
LOG_TRACE("SURVIVAL: ClientConnect, player = ", player.netname);
player.surv_savedplayermodel = player.playermodel;
+ player.surv_defender_team_stat = Team_TeamToNumber(surv_defenderteam);
if (player.surv_role == SURVIVAL_ROLE_NONE)
{
Surv_AddPlayerToTeam(player, player.team);