IEnumerator ServerRoundRestart() { string[] args = Environment.GetCommandLineArgs(); if ((ServerShutsDownOnRoundEnd == false || args.Contains("-NoReboot")) && (ServerAverageFPS >= 45 || GetMemeoryUsagePrecentage() <= 75f) || args.Contains("-AlwaysReboot") == false) { Logger.Log("Server restarting round now.", Category.Round); Chat.AddGameWideSystemMsgToChat("<b>The round is now restarting...</b>"); // Notify all clients that the round has ended EventManager.Broadcast(Event.RoundEnded, true); yield return(WaitFor.Seconds(0.2f)); CustomNetworkManager.Instance.ServerChangeScene("OnlineScene"); StopAllCoroutines(); yield break; } Logger.LogError("Server is rebooting now. If you don't have a way to automatically restart the " + "Unitystation process such as systemctl the server won't be able to restart!", Category.Round); Chat.AddGameWideSystemMsgToChat("<size=72><b>The server is now restarting!</b></size>"); yield return(WaitFor.Seconds(2f)); Application.Quit(); }
public void CmdToggleOOCMute(string adminId, string adminToken) { var admin = PlayerList.Instance.GetAdmin(adminId, adminToken); if (admin == null) { return; } string msg; if (Chat.OOCMute) { Chat.OOCMute = false; msg = "OOC has been unmuted"; } else { Chat.OOCMute = true; msg = "OOC has been muted"; } Chat.AddGameWideSystemMsgToChat($"<color=blue>{msg}</color>"); DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookOOCURL, msg, ""); }
/// <summary> /// End the round and display any relevant reports /// </summary> public virtual void EndRound() { Logger.LogFormat("Ending {0} round!", Category.GameMode, Name); AntagManager.Instance.ShowAntagStatusReport(); var msg = $"The round will restart in {GameManager.Instance.RoundEndTime} seconds."; Chat.AddGameWideSystemMsgToChat(msg); }
/// <summary> /// End the round and display any relevant reports /// </summary> public virtual void EndRound() { Logger.LogFormat("Ending {0} round!", Category.GameMode, Name); AntagManager.Instance.ShowAntagStatusReport(); var msg = $"The round will restart in {GameManager.Instance.RoundEndTime} seconds."; Chat.AddGameWideSystemMsgToChat(msg); DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookOOCURL, "\n A round has ended \n", ""); }
public void VetoVote(string adminId) { voteInProgress = false; FinishVote(); votes.Clear(); Chat.AddGameWideSystemMsgToChat("<color=blue>Vote was Vetoed by admin</color>"); var msg = $"Vote was vetoed by {PlayerList.Instance.GetByUserID(adminId).Username}"; UIManager.Instance.adminChatWindows.adminToAdminChat.ServerAddChatRecord(msg, adminId); Logger.Log(msg, Category.Admin); }
/// <summary> /// End the round and display any relevant reports /// </summary> public void EndRoundReport() { DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookOOCURL, "`A round has ended`", ""); DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookErrorLogURL, "```A round has ended```", ""); Logger.LogFormat("Ending {0} round!", Category.GameMode, Name); StationObjectiveManager.Instance.ShowStationStatusReport(); AntagManager.Instance.ShowAntagStatusReport(); var msg = $"The round will restart in {GameManager.Instance.RoundEndTime} seconds."; Chat.AddGameWideSystemMsgToChat(msg); }
public void CmdStartRound(string adminId, string adminToken, NetworkConnectionToClient sender = null) { if (IsAdmin(adminId, adminToken, sender) == false) return; if (GameManager.Instance.CurrentRoundState == RoundState.PreRound && GameManager.Instance.waitForStart) { GameManager.Instance.StartRound(); Chat.AddGameWideSystemMsgToChat("<color=blue>An Admin started the round early.</color>"); LogAdminAction($"{PlayerList.Instance.GetByUserID(adminId).Username}: Force STARTED the round."); } }
public void CmdToggleOOCMute(string adminId, string adminToken, NetworkConnectionToClient sender = null) { if (IsAdmin(adminId, adminToken, sender) == false) return; Chat.Instance.OOCMute = !Chat.Instance.OOCMute; var msg = $"OOC has been {(Chat.Instance.OOCMute ? "muted" : "unmuted")}"; Chat.AddGameWideSystemMsgToChat($"<color=blue>{msg}</color>"); DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookOOCURL, msg, ""); LogAdminAction($"{PlayerList.Instance.GetByUserID(adminId).Username}: {(Chat.Instance.OOCMute ? "Muted" : "Unmuted")} OOC"); }
public static void Kick(ConnectedPlayer player, string raisins = "4 no raisins") { if (!player.Connection.isConnected) { Logger.Log($"Not kicking, already disconnected: {player}", Category.Connections); return; } Logger.Log($"Kicking {player} : {raisins}", Category.Connections); InfoWindowMessage.Send(player.GameObject, $"Kicked: {raisins}", "Kicked"); Chat.AddGameWideSystemMsgToChat($"Player '{player.Name}' got kicked: {raisins}"); player.Connection.Disconnect(); player.Connection.Dispose(); }
IEnumerator ServerRoundRestart() { Logger.Log("Server restarting round now.", Category.Round); Chat.AddGameWideSystemMsgToChat("The round is now restarting..."); //Notify all clients that the round has ended ServerToClientEventsMsg.SendToAll(EVENT.RoundEnded); yield return(WaitFor.Seconds(0.2f)); CustomNetworkManager.Instance.ServerChangeScene("OnlineScene"); StopAllCoroutines(); }
IEnumerator ServerRoundRestart() { Logger.Log("Server restarting round now.", Category.Round); Chat.AddGameWideSystemMsgToChat("<b>The round is now restarting...</b>"); // Notify all clients that the round has ended EventManager.Broadcast(Event.RoundEnded, true); yield return(WaitFor.Seconds(0.2f)); CustomNetworkManager.Instance.ServerChangeScene("OnlineScene"); StopAllCoroutines(); }
public void ShowStationStatusReport() { StringBuilder statusSB = new StringBuilder($"<color=white><size=60><b>End of Round Report</b></size></color>\n\n", 200); var message = $"End of Round Report on {ServerData.ServerConfig.ServerName}\n"; statusSB.AppendLine(GetObjectiveStatus()); message += $"\n{GetObjectiveStatusNonRich()}"; DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAnnouncementURL, message, ""); // Send the message Chat.AddGameWideSystemMsgToChat(statusSB.ToString()); }
public void CmdStartRound(NetworkConnectionToClient sender = null) { if (IsAdmin(sender, out var player) == false) { return; } if (GameManager.Instance.CurrentRoundState == RoundState.PreRound && GameManager.Instance.waitForStart) { GameManager.Instance.StartRound(); Chat.AddGameWideSystemMsgToChat($"<color={AdminActionChatColor}>An admin started the round early.</color>"); LogAdminAction($"{player.Username}: Force STARTED the round."); } }
public void CmdToggleOOCMute(NetworkConnectionToClient sender = null) { if (IsAdmin(sender, out var player) == false) { return; } Chat.Instance.OOCMute = !Chat.Instance.OOCMute; var msg = $"OOC has been {(Chat.Instance.OOCMute ? "muted" : "unmuted")}"; Chat.AddGameWideSystemMsgToChat($"<color={AdminActionChatColor}>{msg}</color>"); DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookOOCURL, msg, ""); LogAdminAction($"{player.Username}: {(Chat.Instance.OOCMute ? "Muted" : "Unmuted")} OOC"); }
public void CmdEndRound(NetworkConnectionToClient sender = null) { if (IsAdmin(sender, out var player) == false) { return; } if (GameManager.Instance.CurrentRoundState == RoundState.Started) { GameManager.Instance.RoundEndTime = 5; // Quick round end when triggered by admin. VideoPlayerMessage.Send(VideoType.RestartRound); GameManager.Instance.EndRound(); Chat.AddGameWideSystemMsgToChat($"<color={AdminActionChatColor}>An admin ended the round early.</color>"); LogAdminAction($"{player.Username}: Force ENDED the round."); } }
/// <summary> /// End the round and display any relevant reports /// </summary> public void EndRoundReport() { var roundDuration = GameManager.Instance.stationTime.AddHours(-12); var output = $"A round has ended. Round duration: {roundDuration.ToString("HH:mm")}."; DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookOOCURL, $"`{output}`", ""); DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookErrorLogURL, $"```{output} Total errors: {GameManager.Instance.errorCounter}. Unique errors: {GameManager.Instance.uniqueErrorCounter}```", ""); GameManager.Instance.errorCounter = 0; GameManager.Instance.uniqueErrorCounter = 0; Logger.LogFormat("Ending {0} round!", Category.GameMode, Name); StationObjectiveManager.Instance.ShowStationStatusReport(); AntagManager.Instance.ShowAntagStatusReport(); var msg = $"The round will restart in {GameManager.Instance.RoundEndTime} seconds."; Chat.AddGameWideSystemMsgToChat(msg); }
public void CmdStartRound(string adminId, string adminToken) { if (IsAdmin(adminId, adminToken) == false) { return; } if (GameManager.Instance.CurrentRoundState == RoundState.PreRound && GameManager.Instance.waitForStart) { GameManager.Instance.StartRound(); Chat.AddGameWideSystemMsgToChat("<color=blue>An Admin started the round early.</color>"); var msg = $"{PlayerList.Instance.GetByUserID(adminId).Username}: Force STARTED the round."; UIManager.Instance.adminChatWindows.adminToAdminChat.ServerAddChatRecord(msg, null); DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAdminLogURL, msg, ""); } }
/// <summary> /// Show the end of round antag status report with their objectives, grouped by antag type. /// </summary> public void ShowAntagStatusReport() { StringBuilder statusSB = new StringBuilder($"<color=white><size=30><b>End of Round Report</b></size></color>\n\n", 200); var message = $"End of Round Report on {ServerData.ServerConfig.ServerName}\n"; if (ActiveAntags.Count > 0) { // Group all the antags by type and list them together foreach (var antagType in ActiveAntags.GroupBy(t => t.GetType())) { statusSB.AppendLine($"<size=24>The <b>{antagType.Key.Name}s</b> were:\n</size>"); message += $"The {antagType.Key.Name}s were:\n"; foreach (var antag in antagType) { message += $"\n{antag.GetObjectiveStatusNonRich()}\n"; statusSB.AppendLine(antag.GetObjectiveStatus()); } } } else { message += $"\nThere were no antagonists!\n"; statusSB.AppendLine("<size=24>There were no antagonists!</size>"); } if (PlayerList.Instance.ConnectionCount == 1) { message += $"\n There is 1 player online.\n"; } else { message += $"\n There are {PlayerList.Instance.ConnectionCount} players online.\n"; } DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAnnouncementURL, message, ""); // Send the message Chat.AddGameWideSystemMsgToChat(statusSB.ToString()); }
/// <summary> /// Show the end of round antag status report with their objectives, grouped by antag type. /// </summary> public void ShowAntagStatusReport() { StringBuilder statusSB = new StringBuilder(); var message = $""; if (activeAntags.Count > 0) { // Group all the antags by type and list them together foreach (var antagType in activeAntags.GroupBy(t => t.GetType())) { statusSB.AppendLine($"<size={ChatTemplates.LargeText}>The <b>{antagType.First().Antagonist.AntagName}s</b> were:\n</size>"); message += $"The {antagType.First().Antagonist.AntagName}s were:\n"; foreach (var antag in antagType) { message += $"\n{antag.GetObjectiveStatusNonRich()}\n"; statusSB.AppendLine(antag.GetObjectiveStatus()); } } } else { message += $"\nThere were no antagonists!\n"; statusSB.AppendLine($"<size={ChatTemplates.LargeText}>There were no antagonists!</size>"); } if (PlayerList.Instance.ConnectionCount == 1) { message += $"\n There is 1 player online.\n"; } else { message += $"\n There are {PlayerList.Instance.ConnectionCount} players online.\n"; } DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAnnouncementURL, message, ""); // Send the message Chat.AddGameWideSystemMsgToChat(statusSB.ToString()); }
private void Update() { if (rconChatQueue.Count > 0) { var msg = rconChatQueue.Dequeue(); msg = msg.Substring(1, msg.Length - 1); Chat.AddGameWideSystemMsgToChat("[SERVER] " + msg); } if (commandQueue.Count > 0) { ExecuteCommand(commandQueue.Dequeue()); } if (monitorHost != null) { monitorUpdate += Time.deltaTime; if (monitorUpdate > 4f) { monitorUpdate = 0f; BroadcastToSessions(GetMonitorReadOut(), monitorHost.Sessions.Sessions); } } }
/// <summary> /// Show the end of round antag status report with their objectives, grouped by antag type. /// </summary> public void ShowAntagStatusReport() { StringBuilder statusSB = new StringBuilder($"<color=white><size=30><b>End of Round Report</b></size></color>\n\n", 200); if (ActiveAntags.Count > 0) { // Group all the antags by type and list them together foreach (var antagType in ActiveAntags.GroupBy(t => t.GetType())) { statusSB.AppendLine($"<size=24>The <b>{antagType.Key.Name}s</b> were:\n</size>"); foreach (var antag in antagType) { statusSB.AppendLine(antag.GetObjectiveStatus()); } } } else { statusSB.AppendLine("<size=24>There were no antagonists!</size>"); } // Send the message Chat.AddGameWideSystemMsgToChat(statusSB.ToString()); }