diff --git a/Content.Server/Administration/Commands/ShuttleCommands.cs b/Content.Server/Administration/Commands/ShuttleCommands.cs index 6e409eced1..f7db205586 100644 --- a/Content.Server/Administration/Commands/ShuttleCommands.cs +++ b/Content.Server/Administration/Commands/ShuttleCommands.cs @@ -23,7 +23,7 @@ namespace Content.Server.Administration.Commands // ReSharper disable once ConvertIfStatementToSwitchStatement if (args.Length == 1 && TimeSpan.TryParseExact(args[0], Localization.TimeSpanMinutesFormats, loc.DefaultCulture, out var timeSpan)) { - EntitySystem.Get().RequestRoundEnd(timeSpan, false); + EntitySystem.Get().RequestRoundEnd(timeSpan, shell.Player?.AttachedEntity, false); } else if (args.Length == 1) { @@ -31,7 +31,7 @@ namespace Content.Server.Administration.Commands } else { - EntitySystem.Get().RequestRoundEnd(false); + EntitySystem.Get().RequestRoundEnd(shell.Player?.AttachedEntity, false); } } } @@ -45,7 +45,7 @@ namespace Content.Server.Administration.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get().CancelRoundEndCountdown(false); + EntitySystem.Get().CancelRoundEndCountdown(shell.Player?.AttachedEntity, false); } } } diff --git a/Content.Server/Communications/CommunicationsConsoleComponent.cs b/Content.Server/Communications/CommunicationsConsoleComponent.cs index 7945b77e18..3667f134fb 100644 --- a/Content.Server/Communications/CommunicationsConsoleComponent.cs +++ b/Content.Server/Communications/CommunicationsConsoleComponent.cs @@ -90,11 +90,11 @@ namespace Content.Server.Communications switch (obj.Message) { case CommunicationsConsoleCallEmergencyShuttleMessage _: - RoundEndSystem.RequestRoundEnd(); + RoundEndSystem.RequestRoundEnd(obj.Session.AttachedEntity); break; case CommunicationsConsoleRecallEmergencyShuttleMessage _: - RoundEndSystem.CancelRoundEndCountdown(); + RoundEndSystem.CancelRoundEndCountdown(obj.Session.AttachedEntity); break; case CommunicationsConsoleAnnounceMessage msg: if (!CanAnnounce()) @@ -104,7 +104,7 @@ namespace Content.Server.Communications _announceCooldownEndedTokenSource.Cancel(); _announceCooldownEndedTokenSource = new CancellationTokenSource(); LastAnnounceTime = _gameTiming.CurTime; - Timer.Spawn(AnnounceCooldown, () => UpdateBoundInterface(), _announceCooldownEndedTokenSource.Token); + Timer.Spawn(AnnounceCooldown, UpdateBoundInterface, _announceCooldownEndedTokenSource.Token); UpdateBoundInterface(); var message = msg.Message.Length <= 256 ? msg.Message.Trim() : $"{msg.Message.Trim().Substring(0, 256)}..."; diff --git a/Content.Server/RoundEnd/RoundEndSystem.cs b/Content.Server/RoundEnd/RoundEndSystem.cs index 1486c1779a..bc8a6031bf 100644 --- a/Content.Server/RoundEnd/RoundEndSystem.cs +++ b/Content.Server/RoundEnd/RoundEndSystem.cs @@ -1,8 +1,11 @@ using System; using System.Threading; +using Content.Server.Administration.Logs; using Content.Server.Chat.Managers; using Content.Server.GameTicking; +using Content.Shared.Administration.Logs; using Content.Shared.GameTicking; +using Robust.Server.Player; using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -18,6 +21,8 @@ namespace Content.Server.RoundEnd [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IChatManager _chatManager = default!; + [Dependency] private readonly AdminLogSystem _adminLog = default!; + public const float RestartRoundTime = 20f; private CancellationTokenSource _roundEndCancellationTokenSource = new(); @@ -74,12 +79,12 @@ namespace Content.Server.RoundEnd Timer.Spawn(CallCooldown, () => OnCallCooldownEnded?.Invoke(), _callCooldownEndedTokenSource.Token); } - public void RequestRoundEnd(bool checkCooldown = true) + public void RequestRoundEnd(IEntity? requester = null, bool checkCooldown = true) { - RequestRoundEnd(RoundEndCountdownTime, checkCooldown); + RequestRoundEnd(RoundEndCountdownTime, requester, checkCooldown); } - public void RequestRoundEnd(TimeSpan countdownTime, bool checkCooldown = true) + public void RequestRoundEnd(TimeSpan countdownTime, IEntity? requester = null, bool checkCooldown = true) { if (IsRoundEndCountdownStarted) return; @@ -89,6 +94,15 @@ namespace Content.Server.RoundEnd return; } + if (requester != null) + { + _adminLog.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called by {requester}"); + } + else + { + _adminLog.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called"); + } + IsRoundEndCountdownStarted = true; _chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-called-announcement",("minutes", countdownTime.Minutes)), Loc.GetString("Station")); @@ -103,7 +117,7 @@ namespace Content.Server.RoundEnd OnRoundEndCountdownStarted?.Invoke(); } - public void CancelRoundEndCountdown( bool checkCooldown = true) + public void CancelRoundEndCountdown(IEntity? requester = null, bool checkCooldown = true) { if (!IsRoundEndCountdownStarted) return; @@ -113,6 +127,15 @@ namespace Content.Server.RoundEnd return; } + if (requester != null) + { + _adminLog.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled by {requester}"); + } + else + { + _adminLog.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled"); + } + IsRoundEndCountdownStarted = false; _chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-recalled-announcement"), Loc.GetString("Station")); diff --git a/Content.Server/StationEvents/Events/StationEvent.cs b/Content.Server/StationEvents/Events/StationEvent.cs index f80bd9fb2c..234308ac39 100644 --- a/Content.Server/StationEvents/Events/StationEvent.cs +++ b/Content.Server/StationEvents/Events/StationEvent.cs @@ -141,7 +141,7 @@ namespace Content.Server.StationEvents.Events public virtual void Shutdown() { EntitySystem.Get() - .Add(LogType.EventAnnounced, $"Event shutdown: {Name}"); + .Add(LogType.EventStopped, $"Event shutdown: {Name}"); if (EndAnnouncement != null) { diff --git a/Content.Shared/Administration/Logs/LogType.cs b/Content.Shared/Administration/Logs/LogType.cs index 97bd666916..1bc45c4215 100644 --- a/Content.Shared/Administration/Logs/LogType.cs +++ b/Content.Shared/Administration/Logs/LogType.cs @@ -12,4 +12,6 @@ public enum LogType EventStarted = 6, EventRan = 6, EventStopped = 7, + ShuttleCalled = 8, + ShuttleRecalled = 9, }