/// <summary> /// Handles the respawn system for the Capture The Flag game. The respawn system teleports a player to their respective respawn cooldown location, which depends on /// which team they are currently on. If a player is holding the flag and this method gets called, then the flag that they're holding is returned to its base. /// </summary> /// <param name="ctfBot">The <see cref="CaptureTheFlagBot"/> instance.</param> /// <param name="eventArgs">The arguments for when the player (or players) was/were reset.</param> private void OnPlayerReset(CaptureTheFlagBot ctfBot, PlayerResetEventArgs eventArgs) { if (!eventArgs.PropertiesReset) { foreach (Player player in eventArgs.PlayersReset) { if (player.HasEnemyFlag(ctfBot)) { Team enemyTeam = player.Team.GetOppositeTeam(); if (ctfBot.FlagSystem.Flags[enemyTeam].Holder == player) { ctfBot.SayChatMessage($"Player {player.Username} died while holding {enemyTeam.GetStringName()} teams flag."); ctfBot.FlagSystem.Flags[enemyTeam].Return(ctfBot, null, false); } ctfBot.RemoveEffects(player); } RespawnPlayer(ctfBot, player); } } }