void CA_count_alive_players()
{
total_players = redalive = bluealive = yellowalive = pinkalive = 0;
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it), {
switch(it.team)
{
case NUM_TEAM_1: ++total_players; if(!IS_DEAD(it)) ++redalive; break;
case NUM_TEAM_3: ++total_players; if(!IS_DEAD(it)) ++yellowalive; break;
case NUM_TEAM_4: ++total_players; if(!IS_DEAD(it)) ++pinkalive; break;
}
- ));
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
- it.redalive_stat = redalive;
- it.bluealive_stat = bluealive;
- it.yellowalive_stat = yellowalive;
- it.pinkalive_stat = pinkalive;
- ));
+ });
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
+ STAT(REDALIVE, it) = redalive;
+ STAT(BLUEALIVE, it) = bluealive;
+ STAT(YELLOWALIVE, it) = yellowalive;
+ STAT(PINKALIVE, it) = pinkalive;
+ });
}
float CA_GetWinnerTeam()
{
Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER);
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER);
+ FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); });
+
allowed_to_spawn = false;
+ game_stopped = true;
round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(nades_Clear(it)));
return 1;
}
}
allowed_to_spawn = false;
+ game_stopped = true;
round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
- FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(nades_Clear(it)));
+ FOREACH_CLIENT(IS_PLAYER(it), { nades_Clear(it); });
return 1;
}
if (!allowed_to_spawn && IS_PLAYER(player)) // this is true even when player is trying to join
{
TRANSMUTE(Observer, player);
- if (player.jointime != time && !player.caplayer) // not when connecting
+ if (CS(player).jointime != time && !player.caplayer) // not when connecting
{
player.caplayer = 0.5;
Send_Notification(NOTIF_ONE_ONLY, player, MSG_INFO, INFO_CA_JOIN_LATE);
MUTATOR_HOOKFUNCTION(ca, reset_map_players)
{
FOREACH_CLIENT(true, {
- it.killcount = 0;
+ CS(it).killcount = 0;
if (!it.caplayer && IS_BOT_CLIENT(it))
{
it.team = -1;
PutClientInServer(it);
}
});
+ bot_relinkplayerlist();
return true;
}
return true;
}
-MUTATOR_HOOKFUNCTION(ca, GetTeamCount, CBC_ORDER_EXCLUSIVE)
+MUTATOR_HOOKFUNCTION(ca, CheckAllowedTeams, CBC_ORDER_EXCLUSIVE)
{
M_ARGV(0, float) = ca_teams;
}
ca_LastPlayerForTeam_Notify(frag_target);
if (!allowed_to_spawn)
- frag_target.respawn_flags = RESPAWN_SILENT;
+ {
+ frag_target.respawn_flags = RESPAWN_SILENT;
+ // prevent unwanted sudden rejoin as spectator and move of spectator camera
+ frag_target.respawn_time = time + 2;
+ }
if (!warmup_stage)
eliminatedPlayers.SendFlags |= 1;
+ if(IS_BOT_CLIENT(frag_target))
+ bot_clear(frag_target);
return true;
}
start_ammo_fuel = warmup_start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
}
-MUTATOR_HOOKFUNCTION(ca, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(ca, Damage_Calculate)
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
float excess = max(0, frag_damage - damage_take - damage_save);
if (frag_target != frag_attacker && IS_PLAYER(frag_attacker))
- PlayerTeamScore_Add(frag_attacker, SP_SCORE, ST_SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
+ GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
+}
+
+MUTATOR_HOOKFUNCTION(ca, CalculateRespawnTime)
+{
+ // no respawn calculations needed, player is forced to spectate anyway
+ return true;
}
MUTATOR_HOOKFUNCTION(ca, PlayerRegen)
M_ARGV(2, bool) = true; // all weapons
}
+MUTATOR_HOOKFUNCTION(ca, HideTeamNagger)
+{
+ return true; // doesn't work well with the whole spectator as player thing
+}
+
MUTATOR_HOOKFUNCTION(ca, GetPlayerStatus)
{
entity player = M_ARGV(0, entity);