int autocvar_g_surv_team_size;
/// \brief If set, defenders will not be shown on the radar.
int autocvar_g_surv_stealth;
+/// \brief Whether to allow spectating enemy players while dead.
+bool autocvar_g_surv_spectate_enemies;
/// \brief Whether to force overkill player models for attackers.
int autocvar_g_surv_attacker_force_overkill_models;
return true;
}
+MUTATOR_HOOKFUNCTION(surv, SpectateSet)
+{
+ entity client = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+
+ if (!autocvar_g_surv_spectate_enemies &&
+ (client.surv_state == SURVIVAL_STATE_PLAYING) &&
+ DIFF_TEAM(targ, client))
+ {
+ return true;
+ }
+}
+
+MUTATOR_HOOKFUNCTION(surv, SpectateNext)
+{
+ entity client = M_ARGV(0, entity);
+
+ if (!autocvar_g_surv_spectate_enemies &&
+ (client.surv_state == SURVIVAL_STATE_PLAYING))
+ {
+ entity targ = M_ARGV(1, entity);
+ M_ARGV(1, entity) = CA_SpectateNext(client, targ);
+ return true;
+ }
+}
+
+MUTATOR_HOOKFUNCTION(surv, SpectatePrev)
+{
+ entity client = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+ entity first = M_ARGV(2, entity);
+
+ if (!autocvar_g_surv_spectate_enemies &&
+ (client.surv_state == SURVIVAL_STATE_PLAYING))
+ {
+ do
+ {
+ targ = targ.chain;
+ }
+ while (targ && DIFF_TEAM(targ, client));
+ if (!targ)
+ {
+ for (targ = first; targ && DIFF_TEAM(targ, client);
+ targ = targ.chain);
+
+ if (targ == client.enemy)
+ {
+ return MUT_SPECPREV_RETURN;
+ }
+ }
+ }
+ M_ARGV(1, entity) = targ;
+ return MUT_SPECPREV_FOUND;
+}
+
/// \brief I'm not sure exactly what this function does but it is very
/// important. Without it bots are completely broken. Is it a hack? Of course.
MUTATOR_HOOKFUNCTION(surv, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
seta g_surv_point_leadlimit -1 "Survival point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
set g_surv_team_size 4 "How much players are allowed in teams (excluding cannon fodder)"
set g_surv_stealth 0 "If set, defenders will not be shown on the radar"
+set g_surv_spectate_enemies 0 "Whether to allow spectating enemy players while dead"
set g_surv_attacker_force_overkill_models 0 "Whether to force overkill player models for attackers"
set g_surv_defender_force_overkill_models 1 "Whether to force overkill player models for defenders"