X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Fclanarena%2Fsv_clanarena.qc;fp=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Fclanarena%2Fsv_clanarena.qc;h=7a16141fc8ebbe89409b947cdfd9b979da571233;hb=81df9076546717a7aa7c46bb894fcf2b7dc8e30a;hp=d64ce3604a293b4221d21ab5c1de21da31a32bac;hpb=74ae9d49fce8a7363efee2c825688ac2aa96d8cf;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index d64ce3604..7a16141fc 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -1,7 +1,6 @@ #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; @@ -275,6 +274,11 @@ MUTATOR_HOOKFUNCTION(ca, PutClientInServer) 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)) @@ -367,7 +371,10 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver) 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)) @@ -508,7 +515,7 @@ MUTATOR_HOOKFUNCTION(ca, SpectateSet) 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; } @@ -517,7 +524,7 @@ MUTATOR_HOOKFUNCTION(ca, SpectateNext) { 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); @@ -532,7 +539,7 @@ MUTATOR_HOOKFUNCTION(ca, SpectatePrev) 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; }