Add admin logs for shuttle call/recall
This commit is contained in:
@@ -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<RoundEndSystem>().RequestRoundEnd(timeSpan, false);
|
||||
EntitySystem.Get<RoundEndSystem>().RequestRoundEnd(timeSpan, shell.Player?.AttachedEntity, false);
|
||||
}
|
||||
else if (args.Length == 1)
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.Administration.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
EntitySystem.Get<RoundEndSystem>().RequestRoundEnd(false);
|
||||
EntitySystem.Get<RoundEndSystem>().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<RoundEndSystem>().CancelRoundEndCountdown(false);
|
||||
EntitySystem.Get<RoundEndSystem>().CancelRoundEndCountdown(shell.Player?.AttachedEntity, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)}...";
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace Content.Server.StationEvents.Events
|
||||
public virtual void Shutdown()
|
||||
{
|
||||
EntitySystem.Get<AdminLogSystem>()
|
||||
.Add(LogType.EventAnnounced, $"Event shutdown: {Name}");
|
||||
.Add(LogType.EventStopped, $"Event shutdown: {Name}");
|
||||
|
||||
if (EndAnnouncement != null)
|
||||
{
|
||||
|
||||
@@ -12,4 +12,6 @@ public enum LogType
|
||||
EventStarted = 6,
|
||||
EventRan = 6,
|
||||
EventStopped = 7,
|
||||
ShuttleCalled = 8,
|
||||
ShuttleRecalled = 9,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user