#include "sv_clanarena.qh"
float autocvar_g_ca_damage2score = 100;
-bool autocvar_g_ca_spectate_enemies;
bool autocvar_g_ca_prevent_stalemate;
float autocvar_g_ca_start_health = 200;
MUTATOR_HOOKFUNCTION(ca, reset_map_players)
{
+ g_ca_spectate_enemies = autocvar_g_ca_spectate_enemies;
+ observe_blocked_if_eliminated = (g_ca_spectate_enemies == -1);
+ // we can avoid sending observe_blocked_if_eliminated to all clients here (with ClientData_Touch)
+ // since it will get sent whenever the client spectates someone anyway
+
FOREACH_CLIENT(true, {
CS(it).killcount = 0;
if (INGAME(it) || IS_BOT_CLIENT(it))
INGAME_STATUS_CLEAR(player);
}
if (INGAME(player))
+ {
player.frags = FRAGS_PLAYER_OUT_OF_GAME;
+ player.would_spectate = observe_blocked_if_eliminated; // if blocked from observing force to spectate now
+ }
if (!warmup_stage)
eliminatedPlayers.SendFlags |= 1;
if (!INGAME(player))
entity client = M_ARGV(0, entity);
entity targ = M_ARGV(1, entity);
- if (!autocvar_g_ca_spectate_enemies && INGAME(client))
+ if (g_ca_spectate_enemies != 1 && INGAME(client))
if (DIFF_TEAM(targ, client))
return true;
}
{
entity client = M_ARGV(0, entity);
- if (!autocvar_g_ca_spectate_enemies && INGAME(client)
+ if (g_ca_spectate_enemies != 1 && INGAME(client)
&& Team_GetNumberOfAlivePlayers(Entity_GetTeam(client)))
{
entity targ = M_ARGV(1, entity);
entity targ = M_ARGV(1, entity);
entity first = M_ARGV(2, entity);
- if (!autocvar_g_ca_spectate_enemies && INGAME(client)
+ if (g_ca_spectate_enemies != 1 && INGAME(client)
&& Team_GetNumberOfAlivePlayers(Entity_GetTeam(client)))
{
do { targ = targ.chain; }