Add admin logging to system events
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
|
using Content.Shared.Administration.Logs;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
@@ -103,6 +106,9 @@ namespace Content.Server.StationEvents.Events
|
|||||||
{
|
{
|
||||||
Started = true;
|
Started = true;
|
||||||
Occurrences += 1;
|
Occurrences += 1;
|
||||||
|
|
||||||
|
EntitySystem.Get<AdminLogSystem>()
|
||||||
|
.Add(LogType.EventStarted, $"Event startup: {Name}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -111,6 +117,9 @@ namespace Content.Server.StationEvents.Events
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void Announce()
|
public virtual void Announce()
|
||||||
{
|
{
|
||||||
|
EntitySystem.Get<AdminLogSystem>()
|
||||||
|
.Add(LogType.EventAnnounced, $"Event announce: {Name}");
|
||||||
|
|
||||||
if (StartAnnouncement != null)
|
if (StartAnnouncement != null)
|
||||||
{
|
{
|
||||||
var chatManager = IoCManager.Resolve<IChatManager>();
|
var chatManager = IoCManager.Resolve<IChatManager>();
|
||||||
@@ -131,6 +140,9 @@ namespace Content.Server.StationEvents.Events
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void Shutdown()
|
public virtual void Shutdown()
|
||||||
{
|
{
|
||||||
|
EntitySystem.Get<AdminLogSystem>()
|
||||||
|
.Add(LogType.EventAnnounced, $"Event shutdown: {Name}");
|
||||||
|
|
||||||
if (EndAnnouncement != null)
|
if (EndAnnouncement != null)
|
||||||
{
|
{
|
||||||
var chatManager = IoCManager.Resolve<IChatManager>();
|
var chatManager = IoCManager.Resolve<IChatManager>();
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.GameTicking;
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.StationEvents.Events;
|
using Content.Server.StationEvents.Events;
|
||||||
using Content.Shared;
|
using Content.Shared;
|
||||||
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.StationEvents;
|
using Content.Shared.StationEvents;
|
||||||
@@ -33,6 +35,8 @@ namespace Content.Server.StationEvents
|
|||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
|
||||||
|
[Dependency] private readonly AdminLogSystem _adminLog = default!;
|
||||||
|
|
||||||
public StationEvent? CurrentEvent { get; private set; }
|
public StationEvent? CurrentEvent { get; private set; }
|
||||||
public IReadOnlyCollection<StationEvent> StationEvents => _stationEvents;
|
public IReadOnlyCollection<StationEvent> StationEvents => _stationEvents;
|
||||||
|
|
||||||
@@ -91,6 +95,8 @@ namespace Content.Server.StationEvents
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string RunEvent(string name)
|
public string RunEvent(string name)
|
||||||
{
|
{
|
||||||
|
_adminLog.Add(LogType.EventRan, $"Event run: {name}");
|
||||||
|
|
||||||
// Could use a dictionary but it's such a minor thing, eh.
|
// Could use a dictionary but it's such a minor thing, eh.
|
||||||
// Wasn't sure on whether to localize this given it's a command
|
// Wasn't sure on whether to localize this given it's a command
|
||||||
var upperName = name.ToUpperInvariant();
|
var upperName = name.ToUpperInvariant();
|
||||||
|
|||||||
@@ -8,4 +8,8 @@ public enum LogType
|
|||||||
Damaged = 2,
|
Damaged = 2,
|
||||||
Healed = 3,
|
Healed = 3,
|
||||||
Slip = 4,
|
Slip = 4,
|
||||||
|
EventAnnounced = 5,
|
||||||
|
EventStarted = 6,
|
||||||
|
EventRan = 6,
|
||||||
|
EventStopped = 7,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user