From c455b745baf49df6ef975de63dd4915c1251ea02 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Wed, 17 Mar 2021 15:43:31 +0100 Subject: [PATCH] Adds announce command for admins, latejoin announcer is now "station" --- Content.Server/Commands/AnnounceCommand.cs | 41 ++++++++++++++++++++++ Content.Server/GameTicking/GameTicker.cs | 2 +- Resources/Locale/en-US/centcomm.ftl | 2 ++ SpaceStation14.sln.DotSettings | 1 + 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Content.Server/Commands/AnnounceCommand.cs diff --git a/Content.Server/Commands/AnnounceCommand.cs b/Content.Server/Commands/AnnounceCommand.cs new file mode 100644 index 0000000000..39df734a63 --- /dev/null +++ b/Content.Server/Commands/AnnounceCommand.cs @@ -0,0 +1,41 @@ +using System; +using System.Text; +using Content.Server.Administration; +using Content.Server.Interfaces.Chat; +using Content.Shared.Administration; +using Robust.Shared.Console; +using Robust.Shared.IoC; + +namespace Content.Server.Commands +{ + [AdminCommand(AdminFlags.Fun)] + public class AnnounceCommand : IConsoleCommand + { + public string Command => "announce"; + public string Description => "Send an in-game announcement."; + public string Help => $"{Command} or {Command} to send announcement as centcomm."; + public void Execute(IConsoleShell shell, string argStr, string[] args) + { + var chat = IoCManager.Resolve(); + + if (args.Length == 0) + { + shell.WriteError("Not enough arguments! Need at least 1."); + return; + } + + if (args.Length == 1) + { + chat.DispatchStationAnnouncement(args[0]); + shell.WriteLine("Sent!"); + return; + } + + if (args.Length < 2) return; + + var message = string.Join(' ', new ArraySegment(args, 1, args.Length-1)); + chat.DispatchStationAnnouncement(message, args[0]); + shell.WriteLine("Sent!"); + } + } +} diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 064cb2e413..c24a07ea4c 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -945,7 +945,7 @@ namespace Content.Server.GameTicking "latejoin-arrival-announcement", ("character", character.Name), ("job", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(job.Name)) - )); + ), Loc.GetString("latejoin-arrival-sender")); } var mob = _spawnPlayerMob(job, character, lateJoin); diff --git a/Resources/Locale/en-US/centcomm.ftl b/Resources/Locale/en-US/centcomm.ftl index beb82d40e1..4567780fe3 100644 --- a/Resources/Locale/en-US/centcomm.ftl +++ b/Resources/Locale/en-US/centcomm.ftl @@ -1,3 +1,5 @@ ### Automated Centcomm announcements latejoin-arrival-announcement = {$character} ({$job}) has arrived at the station! + +latejoin-arrival-sender = Station diff --git a/SpaceStation14.sln.DotSettings b/SpaceStation14.sln.DotSettings index 52cf5087ea..7db1758d82 100644 --- a/SpaceStation14.sln.DotSettings +++ b/SpaceStation14.sln.DotSettings @@ -82,6 +82,7 @@ <data /> <data><IncludeFilters /><ExcludeFilters><Filter ModuleMask="Lidgren.Network" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /></ExcludeFilters></data> True + True True True True