Make AdminLogsSystem an IoC manager (#8492)

* Make log not entity system

* Fixes
This commit is contained in:
wrexbe
2022-05-28 23:41:17 -07:00
committed by GitHub
parent 0f99a0dd1d
commit 1e0babbd50
79 changed files with 653 additions and 572 deletions

View File

@@ -1,7 +0,0 @@
using Content.Shared.Administration.Logs;
namespace Content.Client.Administration.Logs;
public sealed class AdminLogSystem : SharedAdminLogSystem
{
}

View File

@@ -18,6 +18,7 @@ using Content.Client.Stylesheets;
using Content.Client.Viewport; using Content.Client.Viewport;
using Content.Client.Voting; using Content.Client.Voting;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Administration.Logs;
using Content.Shared.Module; using Content.Shared.Module;
namespace Content.Client.IoC namespace Content.Client.IoC
@@ -45,6 +46,7 @@ namespace Content.Client.IoC
IoCManager.Register<ViewportManager, ViewportManager>(); IoCManager.Register<ViewportManager, ViewportManager>();
IoCManager.Register<IGamePrototypeLoadManager, GamePrototypeLoadManager>(); IoCManager.Register<IGamePrototypeLoadManager, GamePrototypeLoadManager>();
IoCManager.Register<NetworkResourceManager>(); IoCManager.Register<NetworkResourceManager>();
IoCManager.Register<ISharedAdminLogManager, SharedAdminLogManager>();
IoCManager.Register<GhostKickManager>(); IoCManager.Register<GhostKickManager>();
IoCManager.Register<ExtendedDisconnectInformationManager>(); IoCManager.Register<ExtendedDisconnectInformationManager>();
} }

View File

@@ -36,7 +36,7 @@ public sealed class AddTests : ContentIntegrationTest
var sMaps = server.ResolveDependency<IMapManager>(); var sMaps = server.ResolveDependency<IMapManager>();
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
var guid = Guid.NewGuid(); var guid = Guid.NewGuid();
@@ -89,7 +89,7 @@ public sealed class AddTests : ContentIntegrationTest
var sMaps = server.ResolveDependency<IMapManager>(); var sMaps = server.ResolveDependency<IMapManager>();
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
var sGamerTicker = sSystems.GetEntitySystem<GameTicker>(); var sGamerTicker = sSystems.GetEntitySystem<GameTicker>();
var guid = Guid.NewGuid(); var guid = Guid.NewGuid();
@@ -156,7 +156,7 @@ public sealed class AddTests : ContentIntegrationTest
var sMaps = server.ResolveDependency<IMapManager>(); var sMaps = server.ResolveDependency<IMapManager>();
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
await server.WaitPost(() => await server.WaitPost(() =>
{ {
@@ -193,7 +193,7 @@ public sealed class AddTests : ContentIntegrationTest
var sPlayers = server.ResolveDependency<IPlayerManager>(); var sPlayers = server.ResolveDependency<IPlayerManager>();
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
Guid playerGuid = default; Guid playerGuid = default;
await server.WaitPost(() => await server.WaitPost(() =>
@@ -236,7 +236,7 @@ public sealed class AddTests : ContentIntegrationTest
var sDatabase = server.ResolveDependency<IServerDbManager>(); var sDatabase = server.ResolveDependency<IServerDbManager>();
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
var sGamerTicker = sSystems.GetEntitySystem<GameTicker>(); var sGamerTicker = sSystems.GetEntitySystem<GameTicker>();
var guid = Guid.NewGuid(); var guid = Guid.NewGuid();
@@ -279,7 +279,7 @@ public sealed class AddTests : ContentIntegrationTest
await foreach (var json in sDatabase.GetAdminLogsJson(filter)) await foreach (var json in sDatabase.GetAdminLogsJson(filter))
{ {
var root = json.RootElement; var root = json.RootElement;
Assert.That(root.TryGetProperty("guid", out _), Is.True); Assert.That(root.TryGetProperty("guid", out _), Is.True);
json.Dispose(); json.Dispose();
@@ -302,7 +302,7 @@ public sealed class AddTests : ContentIntegrationTest
var sPlayers = server.ResolveDependency<IPlayerManager>(); var sPlayers = server.ResolveDependency<IPlayerManager>();
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
var guid = Guid.NewGuid(); var guid = Guid.NewGuid();
@@ -347,7 +347,7 @@ public sealed class AddTests : ContentIntegrationTest
var sPlayers = server.ResolveDependency<IPlayerManager>(); var sPlayers = server.ResolveDependency<IPlayerManager>();
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
var guid = Guid.NewGuid(); var guid = Guid.NewGuid();

View File

@@ -33,7 +33,7 @@ public sealed class FilterTests : ContentIntegrationTest
var sMaps = server.ResolveDependency<IMapManager>(); var sMaps = server.ResolveDependency<IMapManager>();
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
var commonGuid = Guid.NewGuid(); var commonGuid = Guid.NewGuid();
var firstGuid = Guid.NewGuid(); var firstGuid = Guid.NewGuid();

View File

@@ -33,7 +33,7 @@ public sealed class QueryTests : ContentIntegrationTest
var sSystems = server.ResolveDependency<IEntitySystemManager>(); var sSystems = server.ResolveDependency<IEntitySystemManager>();
var sPlayers = server.ResolveDependency<IPlayerManager>(); var sPlayers = server.ResolveDependency<IPlayerManager>();
var sAdminLogSystem = sSystems.GetEntitySystem<AdminLogSystem>(); var sAdminLogSystem = server.ResolveDependency<IAdminLogManager>();
var sGamerTicker = sSystems.GetEntitySystem<GameTicker>(); var sGamerTicker = sSystems.GetEntitySystem<GameTicker>();
var date = DateTime.UtcNow; var date = DateTime.UtcNow;

View File

@@ -37,7 +37,7 @@ public sealed class AdminLogBulk : IConsoleCommand
return; return;
} }
var logs = EntitySystem.Get<AdminLogSystem>(); var logManager = IoCManager.Resolve<IAdminLogManager>();
var stopwatch = new Stopwatch(); var stopwatch = new Stopwatch();
stopwatch.Start(); stopwatch.Start();
@@ -46,14 +46,14 @@ public sealed class AdminLogBulk : IConsoleCommand
{ {
Parallel.For(0, amount, _ => Parallel.For(0, amount, _ =>
{ {
logs.Add(LogType.Unknown, $"Debug log added by {entity:Player}"); logManager.Add(LogType.Unknown, $"Debug log added by {entity:Player}");
}); });
} }
else else
{ {
for (var i = 0; i < amount; i++) for (var i = 0; i < amount; i++)
{ {
logs.Add(LogType.Unknown, $"Debug log added by {entity:Player}"); logManager.Add(LogType.Unknown, $"Debug log added by {entity:Player}");
} }
} }

View File

@@ -7,7 +7,7 @@ using Prometheus;
namespace Content.Server.Administration.Logs; namespace Content.Server.Administration.Logs;
public sealed partial class AdminLogSystem public sealed partial class AdminLogManager
{ {
private const int MaxRoundsCached = 3; private const int MaxRoundsCached = 3;
private const int LogListInitialSize = 30_000; private const int LogListInitialSize = 30_000;
@@ -26,10 +26,10 @@ public sealed partial class AdminLogSystem
"How many logs are in cache."); "How many logs are in cache.");
// TODO ADMIN LOGS cache previous {MaxRoundsCached} rounds on startup // TODO ADMIN LOGS cache previous {MaxRoundsCached} rounds on startup
private void CacheNewRound() public void CacheNewRound()
{ {
List<SharedAdminLog> list; List<SharedAdminLog> list;
var oldestRound = CurrentRoundId - MaxRoundsCached; var oldestRound = _currentRoundId - MaxRoundsCached;
if (_roundsLogCache.Remove(oldestRound, out var oldestList)) if (_roundsLogCache.Remove(oldestRound, out var oldestList))
{ {
@@ -41,7 +41,7 @@ public sealed partial class AdminLogSystem
list = new List<SharedAdminLog>(LogListInitialSize); list = new List<SharedAdminLog>(LogListInitialSize);
} }
_roundsLogCache.Add(CurrentRoundId, list); _roundsLogCache.Add(_currentRoundId, list);
CacheRoundCount.Set(_roundsLogCache.Count); CacheRoundCount.Set(_roundsLogCache.Count);
} }
@@ -61,14 +61,14 @@ public sealed partial class AdminLogSystem
private void CacheLog(SharedAdminLog log) private void CacheLog(SharedAdminLog log)
{ {
// TODO ADMIN LOGS remove redundant data and don't do a dictionary lookup per log // TODO ADMIN LOGS remove redundant data and don't do a dictionary lookup per log
var cache = _roundsLogCache[CurrentRoundId]; var cache = _roundsLogCache[_currentRoundId];
cache.Add(log); cache.Add(log);
CacheLogCount.Set(cache.Count); CacheLogCount.Set(cache.Count);
} }
private void CacheLogs(IEnumerable<SharedAdminLog> logs) private void CacheLogs(IEnumerable<SharedAdminLog> logs)
{ {
var cache = _roundsLogCache[CurrentRoundId]; var cache = _roundsLogCache[_currentRoundId];
cache.AddRange(logs); cache.AddRange(logs);
CacheLogCount.Set(cache.Count); CacheLogCount.Set(cache.Count);
} }

View File

@@ -7,7 +7,7 @@ using Robust.Server.Player;
namespace Content.Server.Administration.Logs; namespace Content.Server.Administration.Logs;
public sealed partial class AdminLogSystem public sealed partial class AdminLogManager
{ {
private static readonly JsonNamingPolicy NamingPolicy = JsonNamingPolicy.CamelCase; private static readonly JsonNamingPolicy NamingPolicy = JsonNamingPolicy.CamelCase;

View File

@@ -0,0 +1,360 @@
using System.Collections.Concurrent;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Content.Server.Database;
using Content.Server.GameTicking;
using Content.Shared.Administration.Logs;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Prometheus;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Reflection;
using Robust.Shared.Timing;
namespace Content.Server.Administration.Logs;
public sealed partial class AdminLogManager : SharedAdminLogManager, IAdminLogManager
{
[Dependency] private readonly IConfigurationManager _configuration = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IServerDbManager _db = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IDynamicTypeFactory _typeFactory = default!;
[Dependency] private readonly IReflectionManager _reflection = default!;
public const string SawmillId = "admin.logs";
private static readonly Histogram DatabaseUpdateTime = Metrics.CreateHistogram(
"admin_logs_database_time",
"Time used to send logs to the database in ms",
new HistogramConfiguration
{
Buckets = Histogram.LinearBuckets(0, 0.5, 20)
});
private static readonly Gauge Queue = Metrics.CreateGauge(
"admin_logs_queue",
"How many logs are in the queue.");
private static readonly Gauge PreRoundQueue = Metrics.CreateGauge(
"admin_logs_pre_round_queue",
"How many logs are in the pre-round queue.");
private static readonly Gauge QueueCapReached = Metrics.CreateGauge(
"admin_logs_queue_cap_reached",
"Number of times the log queue cap has been reached in a round.");
private static readonly Gauge PreRoundQueueCapReached = Metrics.CreateGauge(
"admin_logs_queue_cap_reached",
"Number of times the pre-round log queue cap has been reached in a round.");
private static readonly Gauge LogsSent = Metrics.CreateGauge(
"admin_logs_sent",
"Amount of logs sent to the database in a round.");
// Init only
private ISawmill _sawmill = default!;
// CVars
private bool _metricsEnabled;
private bool _enabled;
private TimeSpan _queueSendDelay;
private int _queueMax;
private int _preRoundQueueMax;
// Per update
private TimeSpan _nextUpdateTime;
private readonly ConcurrentQueue<QueuedLog> _logQueue = new();
private readonly ConcurrentQueue<QueuedLog> _preRoundLogQueue = new();
// Per round
private int _currentRoundId;
private int _currentLogId;
private int NextLogId => Interlocked.Increment(ref _currentLogId);
private GameRunLevel _runLevel = GameRunLevel.PreRoundLobby;
public void Initialize()
{
_sawmill = _logManager.GetSawmill(SawmillId);
InitializeJson();
_configuration.OnValueChanged(CVars.MetricsEnabled,
value => _metricsEnabled = value, true);
_configuration.OnValueChanged(CCVars.AdminLogsEnabled,
value => _enabled = value, true);
_configuration.OnValueChanged(CCVars.AdminLogsQueueSendDelay,
value => _queueSendDelay = TimeSpan.FromSeconds(value), true);
_configuration.OnValueChanged(CCVars.AdminLogsQueueMax,
value => _queueMax = value, true);
_configuration.OnValueChanged(CCVars.AdminLogsPreRoundQueueMax,
value => _preRoundQueueMax = value, true);
if (_metricsEnabled)
{
PreRoundQueueCapReached.Set(0);
QueueCapReached.Set(0);
LogsSent.Set(0);
}
}
public async Task Shutdown()
{
if (!_logQueue.IsEmpty)
{
await SaveLogs();
}
}
public async void Update()
{
if (_runLevel == GameRunLevel.PreRoundLobby)
{
await PreRoundUpdate();
return;
}
var count = _logQueue.Count;
Queue.Set(count);
var preRoundCount = _preRoundLogQueue.Count;
PreRoundQueue.Set(preRoundCount);
if (count + preRoundCount == 0)
{
return;
}
if (_timing.RealTime >= _nextUpdateTime)
{
await SaveLogs();
return;
}
if (count >= _queueMax)
{
if (_metricsEnabled)
{
QueueCapReached.Inc();
}
_sawmill.Warning($"Maximum cap of {_queueMax} reached for admin logs.");
await SaveLogs();
}
}
private async Task PreRoundUpdate()
{
var preRoundCount = _preRoundLogQueue.Count;
PreRoundQueue.Set(preRoundCount);
if (preRoundCount < _preRoundQueueMax)
{
return;
}
if (_metricsEnabled)
{
PreRoundQueueCapReached.Inc();
}
_sawmill.Warning($"Maximum cap of {_preRoundQueueMax} reached for pre-round admin logs.");
await SaveLogs();
}
private async Task SaveLogs()
{
_nextUpdateTime = _timing.RealTime.Add(_queueSendDelay);
// TODO ADMIN LOGS array pool
var copy = new List<QueuedLog>(_logQueue.Count + _preRoundLogQueue.Count);
copy.AddRange(_logQueue);
_logQueue.Clear();
Queue.Set(0);
if (_runLevel == GameRunLevel.PreRoundLobby && !_preRoundLogQueue.IsEmpty)
{
_sawmill.Error($"Dropping {_preRoundLogQueue.Count} pre-round logs. Current cap: {_preRoundQueueMax}");
}
else
{
foreach (var queued in _preRoundLogQueue)
{
queued.Log.RoundId = _currentRoundId;
CacheLog(queued);
}
copy.AddRange(_preRoundLogQueue);
}
_preRoundLogQueue.Clear();
PreRoundQueue.Set(0);
// ship the logs to Azkaban
var task = Task.Run(async () =>
{
await _db.AddAdminLogs(copy);
});
_sawmill.Debug($"Saving {copy.Count} admin logs.");
if (_metricsEnabled)
{
LogsSent.Inc(copy.Count);
using (DatabaseUpdateTime.NewTimer())
{
await task;
return;
}
}
await task;
}
public void RoundStarting(int id)
{
_currentRoundId = id;
CacheNewRound();
}
public void RunLevelChanged(GameRunLevel level)
{
_runLevel = level;
if (level == GameRunLevel.PreRoundLobby)
{
Interlocked.Exchange(ref _currentLogId, 0);
if (_metricsEnabled)
{
PreRoundQueueCapReached.Set(0);
QueueCapReached.Set(0);
LogsSent.Set(0);
}
}
}
private async void Add(LogType type, LogImpact impact, string message, JsonDocument json, HashSet<Guid> players, Dictionary<int, string?> entities)
{
var logId = NextLogId;
var date = DateTime.UtcNow;
var log = new AdminLog
{
Id = logId,
RoundId = _currentRoundId,
Type = type,
Impact = impact,
Date = date,
Message = message,
Json = json,
Players = new List<AdminLogPlayer>(players.Count)
};
var queued = new QueuedLog(log, entities);
foreach (var id in players)
{
var player = new AdminLogPlayer
{
LogId = logId,
PlayerUserId = id
};
log.Players.Add(player);
}
if (_runLevel == GameRunLevel.PreRoundLobby)
{
_preRoundLogQueue.Enqueue(queued);
}
else
{
_logQueue.Enqueue(queued);
CacheLog(log);
}
}
public override void Add(LogType type, LogImpact impact, ref LogStringHandler handler)
{
if (!_enabled)
{
handler.ToStringAndClear();
return;
}
var (json, players, entities) = ToJson(handler.Values);
var message = handler.ToStringAndClear();
Add(type, impact, message, json, players, entities);
}
public override void Add(LogType type, ref LogStringHandler handler)
{
Add(type, LogImpact.Medium, ref handler);
}
public async Task<List<SharedAdminLog>> All(LogFilter? filter = null)
{
if (TrySearchCache(filter, out var results))
{
return results;
}
var initialSize = Math.Min(filter?.Limit ?? 0, 1000);
var list = new List<SharedAdminLog>(initialSize);
await foreach (var log in _db.GetAdminLogs(filter).WithCancellation(filter?.CancellationToken ?? default))
{
list.Add(log);
}
return list;
}
public IAsyncEnumerable<string> AllMessages(LogFilter? filter = null)
{
return _db.GetAdminLogMessages(filter);
}
public IAsyncEnumerable<JsonDocument> AllJson(LogFilter? filter = null)
{
return _db.GetAdminLogsJson(filter);
}
public Task<Round> Round(int roundId)
{
return _db.GetRound(roundId);
}
public Task<List<SharedAdminLog>> CurrentRoundLogs(LogFilter? filter = null)
{
filter ??= new LogFilter();
filter.Round = _currentRoundId;
return All(filter);
}
public IAsyncEnumerable<string> CurrentRoundMessages(LogFilter? filter = null)
{
filter ??= new LogFilter();
filter.Round = _currentRoundId;
return AllMessages(filter);
}
public IAsyncEnumerable<JsonDocument> CurrentRoundJson(LogFilter? filter = null)
{
filter ??= new LogFilter();
filter.Round = _currentRoundId;
return AllJson(filter);
}
public Task<Round> CurrentRound()
{
return Round(_currentRoundId);
}
}

View File

@@ -1,367 +1,31 @@
using System.Collections.Concurrent; using Content.Server.GameTicking;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Content.Server.Database;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Events; using Content.Server.GameTicking.Events;
using Content.Shared.Administration.Logs;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Prometheus;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Reflection;
namespace Content.Server.Administration.Logs; namespace Content.Server.Administration.Logs;
public sealed partial class AdminLogSystem : SharedAdminLogSystem /// <summary>
/// For system events that the manager needs to know about.
/// <see cref="IAdminLogManager"/> for admin log usage.
/// </summary>
public sealed class AdminLogSystem : EntitySystem
{ {
[Dependency] private readonly IConfigurationManager _configuration = default!; [Dependency] private readonly IAdminLogManager _adminLogs = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IServerDbManager _db = default!;
[Dependency] private readonly IDynamicTypeFactory _typeFactory = default!;
[Dependency] private readonly IReflectionManager _reflection = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
public const string SawmillId = "admin.logs";
private static readonly Histogram DatabaseUpdateTime = Metrics.CreateHistogram(
"admin_logs_database_time",
"Time used to send logs to the database in ms",
new HistogramConfiguration
{
Buckets = Histogram.LinearBuckets(0, 0.5, 20)
});
private static readonly Gauge Queue = Metrics.CreateGauge(
"admin_logs_queue",
"How many logs are in the queue.");
private static readonly Gauge PreRoundQueue = Metrics.CreateGauge(
"admin_logs_pre_round_queue",
"How many logs are in the pre-round queue.");
private static readonly Gauge QueueCapReached = Metrics.CreateGauge(
"admin_logs_queue_cap_reached",
"Number of times the log queue cap has been reached in a round.");
private static readonly Gauge PreRoundQueueCapReached = Metrics.CreateGauge(
"admin_logs_queue_cap_reached",
"Number of times the pre-round log queue cap has been reached in a round.");
private static readonly Gauge LogsSent = Metrics.CreateGauge(
"admin_logs_sent",
"Amount of logs sent to the database in a round.");
// Init only
private ISawmill _sawmill = default!;
// CVars
private bool _metricsEnabled;
private bool _enabled;
private TimeSpan _queueSendDelay;
private int _queueMax;
private int _preRoundQueueMax;
// Per update
private float _accumulatedFrameTime;
private readonly ConcurrentQueue<QueuedLog> _logQueue = new();
private readonly ConcurrentQueue<QueuedLog> _preRoundLogQueue = new();
// Per round
private int CurrentRoundId => _gameTicker.RoundId;
private int _currentLogId;
private int NextLogId => Interlocked.Increment(ref _currentLogId);
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
_sawmill = _logManager.GetSawmill(SawmillId); SubscribeLocalEvent<RoundStartingEvent>(ev => _adminLogs.RoundStarting(ev.Id));
SubscribeLocalEvent<GameRunLevelChangedEvent>(ev => _adminLogs.RunLevelChanged(ev.New));
InitializeJson();
_configuration.OnValueChanged(CVars.MetricsEnabled,
value => _metricsEnabled = value, true);
_configuration.OnValueChanged(CCVars.AdminLogsEnabled,
value => _enabled = value, true);
_configuration.OnValueChanged(CCVars.AdminLogsQueueSendDelay,
value => _queueSendDelay = TimeSpan.FromSeconds(value), true);
_configuration.OnValueChanged(CCVars.AdminLogsQueueMax,
value => _queueMax = value, true);
_configuration.OnValueChanged(CCVars.AdminLogsPreRoundQueueMax,
value => _preRoundQueueMax = value, true);
if (_metricsEnabled)
{
PreRoundQueueCapReached.Set(0);
QueueCapReached.Set(0);
LogsSent.Set(0);
}
SubscribeLocalEvent<RoundStartingEvent>(RoundStarting);
SubscribeLocalEvent<GameRunLevelChangedEvent>(RunLevelChanged);
} }
public override async void Shutdown() public override void Update(float frameTime)
{ {
base.Shutdown(); _adminLogs.Update();
if (!_logQueue.IsEmpty)
{
await SaveLogs();
}
} }
public override async void Update(float frameTime) public override void Shutdown()
{ {
if (_gameTicker.RunLevel == GameRunLevel.PreRoundLobby) _adminLogs.Shutdown();
{
await PreRoundUpdate();
return;
}
var count = _logQueue.Count;
Queue.Set(count);
var preRoundCount = _preRoundLogQueue.Count;
PreRoundQueue.Set(preRoundCount);
if (count + preRoundCount == 0)
{
return;
}
if (_accumulatedFrameTime >= _queueSendDelay.TotalSeconds)
{
await SaveLogs();
return;
}
if (count >= _queueMax)
{
if (_metricsEnabled)
{
QueueCapReached.Inc();
}
_sawmill.Warning($"Maximum cap of {_queueMax} reached for admin logs.");
await SaveLogs();
return;
}
_accumulatedFrameTime += frameTime;
}
private async Task PreRoundUpdate()
{
var preRoundCount = _preRoundLogQueue.Count;
PreRoundQueue.Set(preRoundCount);
if (preRoundCount < _preRoundQueueMax)
{
return;
}
if (_metricsEnabled)
{
PreRoundQueueCapReached.Inc();
}
_sawmill.Warning($"Maximum cap of {_preRoundQueueMax} reached for pre-round admin logs.");
await SaveLogs();
}
private async Task SaveLogs()
{
_accumulatedFrameTime = 0f;
// TODO ADMIN LOGS array pool
var copy = new List<QueuedLog>(_logQueue.Count + _preRoundLogQueue.Count);
copy.AddRange(_logQueue);
_logQueue.Clear();
Queue.Set(0);
if (_gameTicker.RunLevel == GameRunLevel.PreRoundLobby)
{
_sawmill.Error($"Dropping {_preRoundLogQueue.Count} pre-round logs. Current cap: {_preRoundQueueMax}");
}
else
{
foreach (var queued in _preRoundLogQueue)
{
queued.Log.RoundId = _gameTicker.RoundId;
CacheLog(queued);
}
copy.AddRange(_preRoundLogQueue);
}
_preRoundLogQueue.Clear();
PreRoundQueue.Set(0);
// ship the logs to Azkaban
var task = Task.Run(async () =>
{
await _db.AddAdminLogs(copy);
});
_sawmill.Debug($"Saving {copy.Count} admin logs.");
if (_metricsEnabled)
{
LogsSent.Inc(copy.Count);
using (DatabaseUpdateTime.NewTimer())
{
await task;
return;
}
}
await task;
}
private void RoundStarting(RoundStartingEvent ev)
{
CacheNewRound();
}
private void RunLevelChanged(GameRunLevelChangedEvent ev)
{
if (ev.New == GameRunLevel.PreRoundLobby)
{
Interlocked.Exchange(ref _currentLogId, 0);
if (_metricsEnabled)
{
PreRoundQueueCapReached.Set(0);
QueueCapReached.Set(0);
LogsSent.Set(0);
}
}
}
private async void Add(LogType type, LogImpact impact, string message, JsonDocument json, HashSet<Guid> players, Dictionary<int, string?> entities)
{
var logId = NextLogId;
var date = DateTime.UtcNow;
var log = new AdminLog
{
Id = logId,
RoundId = CurrentRoundId,
Type = type,
Impact = impact,
Date = date,
Message = message,
Json = json,
Players = new List<AdminLogPlayer>(players.Count)
};
var queued = new QueuedLog(log, entities);
foreach (var id in players)
{
var player = new AdminLogPlayer
{
LogId = logId,
PlayerUserId = id
};
log.Players.Add(player);
}
if (_gameTicker.RunLevel == GameRunLevel.PreRoundLobby)
{
_preRoundLogQueue.Enqueue(queued);
}
else
{
_logQueue.Enqueue(queued);
CacheLog(log);
}
}
public override void Add(LogType type, LogImpact impact, ref LogStringHandler handler)
{
if (!_enabled)
{
handler.ToStringAndClear();
return;
}
var (json, players, entities) = ToJson(handler.Values);
var message = handler.ToStringAndClear();
Add(type, impact, message, json, players, entities);
}
public override void Add(LogType type, ref LogStringHandler handler)
{
Add(type, LogImpact.Medium, ref handler);
}
public async Task<List<SharedAdminLog>> All(LogFilter? filter = null)
{
if (TrySearchCache(filter, out var results))
{
return results;
}
var initialSize = Math.Min(filter?.Limit ?? 0, 1000);
var list = new List<SharedAdminLog>(initialSize);
await foreach (var log in _db.GetAdminLogs(filter).WithCancellation(filter?.CancellationToken ?? default))
{
list.Add(log);
}
return list;
}
public IAsyncEnumerable<string> AllMessages(LogFilter? filter = null)
{
return _db.GetAdminLogMessages(filter);
}
public IAsyncEnumerable<JsonDocument> AllJson(LogFilter? filter = null)
{
return _db.GetAdminLogsJson(filter);
}
public Task<Round> Round(int roundId)
{
return _db.GetRound(roundId);
}
public Task<List<SharedAdminLog>> CurrentRoundLogs(LogFilter? filter = null)
{
filter ??= new LogFilter();
filter.Round = CurrentRoundId;
return All(filter);
}
public IAsyncEnumerable<string> CurrentRoundMessages(LogFilter? filter = null)
{
filter ??= new LogFilter();
filter.Round = CurrentRoundId;
return AllMessages(filter);
}
public IAsyncEnumerable<JsonDocument> CurrentRoundJson(LogFilter? filter = null)
{
filter ??= new LogFilter();
filter.Round = CurrentRoundId;
return AllJson(filter);
}
public Task<Round> CurrentRound()
{
return Round(CurrentRoundId);
} }
} }

View File

@@ -16,12 +16,12 @@ namespace Content.Server.Administration.Logs;
public sealed class AdminLogsEui : BaseEui public sealed class AdminLogsEui : BaseEui
{ {
[Dependency] private readonly IAdminLogManager _adminLogs = default!;
[Dependency] private readonly IAdminManager _adminManager = default!; [Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IConfigurationManager _configuration = default!; [Dependency] private readonly IConfigurationManager _configuration = default!;
private readonly ISawmill _sawmill; private readonly ISawmill _sawmill;
private readonly AdminLogSystem _logSystem;
private int _clientBatchSize; private int _clientBatchSize;
private bool _isLoading = true; private bool _isLoading = true;
@@ -33,12 +33,10 @@ public sealed class AdminLogsEui : BaseEui
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_sawmill = _logManager.GetSawmill(AdminLogSystem.SawmillId); _sawmill = _logManager.GetSawmill(AdminLogManager.SawmillId);
_configuration.OnValueChanged(CCVars.AdminLogsClientBatchSize, ClientBatchSizeChanged, true); _configuration.OnValueChanged(CCVars.AdminLogsClientBatchSize, ClientBatchSizeChanged, true);
_logSystem = EntitySystem.Get<AdminLogSystem>();
_filter = new LogFilter _filter = new LogFilter
{ {
CancellationToken = _logSendCancellation.Token, CancellationToken = _logSendCancellation.Token,
@@ -146,7 +144,7 @@ public sealed class AdminLogsEui : BaseEui
await Task.Run(async () => await Task.Run(async () =>
{ {
logs = await _logSystem.All(_filter); logs = await _adminLogs.All(_filter);
}, _filter.CancellationToken); }, _filter.CancellationToken);
if (logs.Count > 0) if (logs.Count > 0)
@@ -186,7 +184,7 @@ public sealed class AdminLogsEui : BaseEui
_isLoading = true; _isLoading = true;
StateDirty(); StateDirty();
var round = await Task.Run(() => _logSystem.Round(roundId)); var round = await Task.Run(() => _adminLogs.Round(roundId));
var players = round.Players var players = round.Players
.ToDictionary(player => player.UserId, player => player.LastSeenUserName); .ToDictionary(player => player.UserId, player => player.LastSeenUserName);

View File

@@ -0,0 +1,26 @@
using System.Text.Json;
using System.Threading.Tasks;
using Content.Server.Database;
using Content.Server.GameTicking;
using Content.Shared.Administration.Logs;
namespace Content.Server.Administration.Logs;
public interface IAdminLogManager : ISharedAdminLogManager
{
void Initialize();
Task Shutdown();
void Update();
void RoundStarting(int id);
void RunLevelChanged(GameRunLevel level);
Task<List<SharedAdminLog>> All(LogFilter? filter = null);
IAsyncEnumerable<string> AllMessages(LogFilter? filter = null);
IAsyncEnumerable<JsonDocument> AllJson(LogFilter? filter = null);
Task<Round> Round(int roundId);
Task<List<SharedAdminLog>> CurrentRoundLogs(LogFilter? filter = null);
IAsyncEnumerable<string> CurrentRoundMessages(LogFilter? filter = null);
IAsyncEnumerable<JsonDocument> CurrentRoundJson(LogFilter? filter = null);
Task<Round> CurrentRound();
}

View File

@@ -479,7 +479,7 @@ namespace Content.Server.Atmos.EntitySystems
} }
if(tileCount > 10 && (totalMolesRemoved / tileCount) > 20) if(tileCount > 10 && (totalMolesRemoved / tileCount) > 20)
_adminLog.Add(LogType.ExplosiveDepressurization, LogImpact.High, _adminLogger.Add(LogType.ExplosiveDepressurization, LogImpact.High,
$"Explosive depressurization removed {totalMolesRemoved} moles from {tileCount} tiles starting from position {tile.GridIndices:position} on grid ID {tile.GridIndex:grid}"); $"Explosive depressurization removed {totalMolesRemoved} moles from {tileCount} tiles starting from position {tile.GridIndices:position} on grid ID {tile.GridIndex:grid}");
Array.Clear(_depressurizeTiles, 0, Atmospherics.MonstermosHardTileLimit); Array.Clear(_depressurizeTiles, 0, Atmospherics.MonstermosHardTileLimit);

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Atmos.EntitySystems
public sealed partial class AtmosphereSystem : SharedAtmosphereSystem public sealed partial class AtmosphereSystem : SharedAtmosphereSystem
{ {
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly AdminLogSystem _adminLog = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedContainerSystem _containers = default!; [Dependency] private readonly SharedContainerSystem _containers = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!;
private const float UpdateTimer = 1f; private const float UpdateTimer = 1f;
@@ -172,7 +172,7 @@ namespace Content.Server.Atmos.EntitySystems
if (!barotrauma.TakingDamage) if (!barotrauma.TakingDamage)
{ {
barotrauma.TakingDamage = true; barotrauma.TakingDamage = true;
_logSystem.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} started taking low pressure damage"); _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} started taking low pressure damage");
} }
if (pressure <= Atmospherics.HazardLowPressure) if (pressure <= Atmospherics.HazardLowPressure)
@@ -199,7 +199,7 @@ namespace Content.Server.Atmos.EntitySystems
if (!barotrauma.TakingDamage) if (!barotrauma.TakingDamage)
{ {
barotrauma.TakingDamage = true; barotrauma.TakingDamage = true;
_logSystem.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} started taking high pressure damage"); _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} started taking high pressure damage");
} }
if (pressure >= Atmospherics.HazardHighPressure) if (pressure >= Atmospherics.HazardHighPressure)
@@ -216,7 +216,7 @@ namespace Content.Server.Atmos.EntitySystems
if (barotrauma.TakingDamage) if (barotrauma.TakingDamage)
{ {
barotrauma.TakingDamage = false; barotrauma.TakingDamage = false;
_logSystem.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} stopped taking pressure damage"); _adminLogger.Add(LogType.Barotrauma, $"{ToPrettyString(barotrauma.Owner):entity} stopped taking pressure damage");
} }
_alertsSystem.ClearAlertCategory(barotrauma.Owner, AlertCategory.Pressure); _alertsSystem.ClearAlertCategory(barotrauma.Owner, AlertCategory.Pressure);
break; break;

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly TemperatureSystem _temperatureSystem = default!; [Dependency] private readonly TemperatureSystem _temperatureSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
private const float MinimumFireStacks = -10f; private const float MinimumFireStacks = -10f;
private const float MaximumFireStacks = 20f; private const float MaximumFireStacks = 20f;
@@ -151,7 +151,7 @@ namespace Content.Server.Atmos.EntitySystems
if (!flammable.OnFire) if (!flammable.OnFire)
return; return;
_logSystem.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} stopped being on fire damage"); _adminLogger.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} stopped being on fire damage");
flammable.OnFire = false; flammable.OnFire = false;
flammable.FireStacks = 0; flammable.FireStacks = 0;
@@ -167,7 +167,7 @@ namespace Content.Server.Atmos.EntitySystems
if (flammable.FireStacks > 0 && !flammable.OnFire) if (flammable.FireStacks > 0 && !flammable.OnFire)
{ {
_logSystem.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} is on fire"); _adminLogger.Add(LogType.Flammable, $"{ToPrettyString(flammable.Owner):entity} is on fire");
flammable.OnFire = true; flammable.OnFire = true;
} }
@@ -243,7 +243,7 @@ namespace Content.Server.Atmos.EntitySystems
{ {
// TODO FLAMMABLE: further balancing // TODO FLAMMABLE: further balancing
var damageScale = Math.Min((int)flammable.FireStacks, 5); var damageScale = Math.Min((int)flammable.FireStacks, 5);
if(TryComp(uid, out TemperatureComponent? temp)) if(TryComp(uid, out TemperatureComponent? temp))
_temperatureSystem.ChangeHeat(uid, 12500 * damageScale, false, temp); _temperatureSystem.ChangeHeat(uid, 12500 * damageScale, false, temp);

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
public sealed class GasPressurePumpSystem : EntitySystem public sealed class GasPressurePumpSystem : EntitySystem
{ {
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
@@ -116,7 +116,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
private void OnToggleStatusMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpToggleStatusMessage args) private void OnToggleStatusMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpToggleStatusMessage args)
{ {
pump.Enabled = args.Enabled; pump.Enabled = args.Enabled;
_adminLogSystem.Add(LogType.AtmosPowerChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
DirtyUI(uid, pump); DirtyUI(uid, pump);
} }
@@ -124,7 +124,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
private void OnOutputPressureChangeMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpChangeOutputPressureMessage args) private void OnOutputPressureChangeMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpChangeOutputPressureMessage args)
{ {
pump.TargetPressure = Math.Clamp(args.Pressure, 0f, Atmospherics.MaxOutputPressure); pump.TargetPressure = Math.Clamp(args.Pressure, 0f, Atmospherics.MaxOutputPressure);
_adminLogSystem.Add(LogType.AtmosPressureChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa");
DirtyUI(uid, pump); DirtyUI(uid, pump);

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
public override void Initialize() public override void Initialize()
@@ -121,7 +121,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
private void OnToggleStatusMessage(EntityUid uid, GasVolumePumpComponent pump, GasVolumePumpToggleStatusMessage args) private void OnToggleStatusMessage(EntityUid uid, GasVolumePumpComponent pump, GasVolumePumpToggleStatusMessage args)
{ {
pump.Enabled = args.Enabled; pump.Enabled = args.Enabled;
_adminLogSystem.Add(LogType.AtmosPowerChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
DirtyUI(uid, pump); DirtyUI(uid, pump);
} }
@@ -129,7 +129,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
private void OnTransferRateChangeMessage(EntityUid uid, GasVolumePumpComponent pump, GasVolumePumpChangeTransferRateMessage args) private void OnTransferRateChangeMessage(EntityUid uid, GasVolumePumpComponent pump, GasVolumePumpChangeTransferRateMessage args)
{ {
pump.TransferRate = Math.Clamp(args.TransferRate, 0f, pump.MaxTransferRate); pump.TransferRate = Math.Clamp(args.TransferRate, 0f, pump.MaxTransferRate);
_adminLogSystem.Add(LogType.AtmosVolumeChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosVolumeChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.TransferRate}"); $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.TransferRate}");
DirtyUI(uid, pump); DirtyUI(uid, pump);
} }

View File

@@ -22,7 +22,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
{ {
[Dependency] private IGameTiming _gameTiming = default!; [Dependency] private IGameTiming _gameTiming = default!;
[Dependency] private UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private AdminLogSystem _adminLogSystem = default!; [Dependency] private IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
@@ -140,7 +140,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
private void OnToggleStatusMessage(EntityUid uid, GasFilterComponent filter, GasFilterToggleStatusMessage args) private void OnToggleStatusMessage(EntityUid uid, GasFilterComponent filter, GasFilterToggleStatusMessage args)
{ {
filter.Enabled = args.Enabled; filter.Enabled = args.Enabled;
_adminLogSystem.Add(LogType.AtmosPowerChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
DirtyUI(uid, filter); DirtyUI(uid, filter);
@@ -149,7 +149,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
private void OnTransferRateChangeMessage(EntityUid uid, GasFilterComponent filter, GasFilterChangeRateMessage args) private void OnTransferRateChangeMessage(EntityUid uid, GasFilterComponent filter, GasFilterChangeRateMessage args)
{ {
filter.TransferRate = Math.Clamp(args.Rate, 0f, filter.MaxTransferRate); filter.TransferRate = Math.Clamp(args.Rate, 0f, filter.MaxTransferRate);
_adminLogSystem.Add(LogType.AtmosVolumeChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosVolumeChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.Rate}"); $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.Rate}");
DirtyUI(uid, filter); DirtyUI(uid, filter);

View File

@@ -20,7 +20,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
public sealed class GasMixerSystem : EntitySystem public sealed class GasMixerSystem : EntitySystem
{ {
[Dependency] private UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private AdminLogSystem _adminLogSystem = default!; [Dependency] private IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
@@ -180,7 +180,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
private void OnToggleStatusMessage(EntityUid uid, GasMixerComponent mixer, GasMixerToggleStatusMessage args) private void OnToggleStatusMessage(EntityUid uid, GasMixerComponent mixer, GasMixerToggleStatusMessage args)
{ {
mixer.Enabled = args.Enabled; mixer.Enabled = args.Enabled;
_adminLogSystem.Add(LogType.AtmosPowerChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
DirtyUI(uid, mixer); DirtyUI(uid, mixer);
UpdateAppearance(uid, mixer); UpdateAppearance(uid, mixer);
@@ -189,7 +189,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
private void OnOutputPressureChangeMessage(EntityUid uid, GasMixerComponent mixer, GasMixerChangeOutputPressureMessage args) private void OnOutputPressureChangeMessage(EntityUid uid, GasMixerComponent mixer, GasMixerChangeOutputPressureMessage args)
{ {
mixer.TargetPressure = Math.Clamp(args.Pressure, 0f, mixer.MaxTargetPressure); mixer.TargetPressure = Math.Clamp(args.Pressure, 0f, mixer.MaxTargetPressure);
_adminLogSystem.Add(LogType.AtmosPressureChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa");
DirtyUI(uid, mixer); DirtyUI(uid, mixer);
} }
@@ -200,7 +200,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
float nodeOne = Math.Clamp(args.NodeOne, 0f, 100.0f) / 100.0f; float nodeOne = Math.Clamp(args.NodeOne, 0f, 100.0f) / 100.0f;
mixer.InletOneConcentration = nodeOne; mixer.InletOneConcentration = nodeOne;
mixer.InletTwoConcentration = 1.0f - mixer.InletOneConcentration; mixer.InletTwoConcentration = 1.0f - mixer.InletOneConcentration;
_adminLogSystem.Add(LogType.AtmosRatioChanged, LogImpact.Medium, _adminLogger.Add(LogType.AtmosRatioChanged, LogImpact.Medium,
$"{EntityManager.ToPrettyString(args.Session.AttachedEntity!.Value):player} set the ratio on {EntityManager.ToPrettyString(uid):device} to {mixer.InletOneConcentration}:{mixer.InletTwoConcentration}"); $"{EntityManager.ToPrettyString(args.Session.AttachedEntity!.Value):player} set the ratio on {EntityManager.ToPrettyString(uid):device} to {mixer.InletOneConcentration}:{mixer.InletTwoConcentration}");
DirtyUI(uid, mixer); DirtyUI(uid, mixer);
} }

View File

@@ -22,7 +22,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
{ {
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
public override void Initialize() public override void Initialize()
@@ -56,7 +56,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (environment is not null) if (environment is not null)
_atmosphereSystem.Merge(environment, canister.Air); _atmosphereSystem.Merge(environment, canister.Air);
_adminLogSystem.Add(LogType.CanisterPurged, LogImpact.Medium, $"Canister {ToPrettyString(uid):canister} purged its contents of {canister.Air:gas} into the environment."); _adminLogger.Add(LogType.CanisterPurged, LogImpact.Medium, $"Canister {ToPrettyString(uid):canister} purged its contents of {canister.Air:gas} into the environment.");
canister.Air.Clear(); canister.Air.Clear();
} }
@@ -110,7 +110,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (container.ContainedEntities.Count == 0) if (container.ContainedEntities.Count == 0)
return; return;
_adminLogSystem.Add(LogType.CanisterTankEjected, LogImpact.Medium, $"Player {ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} ejected tank {ToPrettyString(container.ContainedEntities[0]):tank} from {ToPrettyString(uid):canister}"); _adminLogger.Add(LogType.CanisterTankEjected, LogImpact.Medium, $"Player {ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} ejected tank {ToPrettyString(container.ContainedEntities[0]):tank} from {ToPrettyString(uid):canister}");
container.Remove(container.ContainedEntities[0]); container.Remove(container.ContainedEntities[0]);
} }
@@ -118,7 +118,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
{ {
var pressure = Math.Clamp(args.Pressure, canister.MinReleasePressure, canister.MaxReleasePressure); var pressure = Math.Clamp(args.Pressure, canister.MinReleasePressure, canister.MaxReleasePressure);
_adminLogSystem.Add(LogType.CanisterPressure, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the release pressure on {ToPrettyString(uid):canister} to {args.Pressure}"); _adminLogger.Add(LogType.CanisterPressure, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the release pressure on {ToPrettyString(uid):canister} to {args.Pressure}");
canister.ReleasePressure = pressure; canister.ReleasePressure = pressure;
DirtyUI(uid, canister); DirtyUI(uid, canister);
@@ -131,7 +131,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
&& containerManager.TryGetContainer(canister.ContainerName, out var container)) && containerManager.TryGetContainer(canister.ContainerName, out var container))
impact = container.ContainedEntities.Count != 0 ? LogImpact.Medium : LogImpact.High; impact = container.ContainedEntities.Count != 0 ? LogImpact.Medium : LogImpact.High;
_adminLogSystem.Add(LogType.CanisterValve, impact, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the valve on {ToPrettyString(uid):canister} to {args.Valve:valveState}"); _adminLogger.Add(LogType.CanisterValve, impact, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the valve on {ToPrettyString(uid):canister} to {args.Valve:valveState}");
canister.ReleaseValve = args.Valve; canister.ReleaseValve = args.Valve;
DirtyUI(uid, canister); DirtyUI(uid, canister);
@@ -245,7 +245,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (!_handsSystem.TryDropIntoContainer(args.User, args.Used, container)) if (!_handsSystem.TryDropIntoContainer(args.User, args.Used, container))
return; return;
_adminLogSystem.Add(LogType.CanisterTankInserted, LogImpact.Medium, $"Player {ToPrettyString(args.User):player} inserted tank {ToPrettyString(container.ContainedEntities[0]):tank} into {ToPrettyString(canister):canister}"); _adminLogger.Add(LogType.CanisterTankInserted, LogImpact.Medium, $"Player {ToPrettyString(args.User):player} inserted tank {ToPrettyString(container.ContainedEntities[0]):tank} into {ToPrettyString(canister):canister}");
args.Handled = true; args.Handled = true;
} }

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Body.Systems
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -182,7 +182,7 @@ namespace Content.Server.Body.Systems
if (effect.ShouldLog) if (effect.ShouldLog)
{ {
_logSystem.Add(LogType.ReagentEffect, effect.LogImpact, _adminLogger.Add(LogType.ReagentEffect, effect.LogImpact,
$"Metabolism effect {effect.GetType().Name:effect} of reagent {args.Reagent.LocalizedName:reagent} applied on entity {actualEntity:entity} at {Transform(actualEntity).Coordinates:coordinates}"); $"Metabolism effect {effect.GetType().Name:effect} of reagent {args.Reagent.LocalizedName:reagent} applied on entity {actualEntity:entity} at {Transform(actualEntity).Coordinates:coordinates}");
} }

View File

@@ -19,7 +19,7 @@ namespace Content.Server.Body.Systems
public sealed class RespiratorSystem : EntitySystem public sealed class RespiratorSystem : EntitySystem
{ {
[Dependency] private readonly DamageableSystem _damageableSys = default!; [Dependency] private readonly DamageableSystem _damageableSys = default!;
[Dependency] private readonly AdminLogSystem _logSys = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly BodySystem _bodySystem = default!; [Dependency] private readonly BodySystem _bodySystem = default!;
[Dependency] private readonly LungSystem _lungSystem = default!; [Dependency] private readonly LungSystem _lungSystem = default!;
[Dependency] private readonly AtmosphereSystem _atmosSys = default!; [Dependency] private readonly AtmosphereSystem _atmosSys = default!;
@@ -154,7 +154,7 @@ namespace Content.Server.Body.Systems
private void TakeSuffocationDamage(EntityUid uid, RespiratorComponent respirator) private void TakeSuffocationDamage(EntityUid uid, RespiratorComponent respirator)
{ {
if (respirator.SuffocationCycles == 2) if (respirator.SuffocationCycles == 2)
_logSys.Add(LogType.Asphyxiation, $"{ToPrettyString(uid):entity} started suffocating"); _adminLogger.Add(LogType.Asphyxiation, $"{ToPrettyString(uid):entity} started suffocating");
if (respirator.SuffocationCycles >= respirator.SuffocationCycleThreshold) if (respirator.SuffocationCycles >= respirator.SuffocationCycleThreshold)
{ {
@@ -167,7 +167,7 @@ namespace Content.Server.Body.Systems
private void StopSuffocation(EntityUid uid, RespiratorComponent respirator) private void StopSuffocation(EntityUid uid, RespiratorComponent respirator)
{ {
if (respirator.SuffocationCycles >= 2) if (respirator.SuffocationCycles >= 2)
_logSys.Add(LogType.Asphyxiation, $"{ToPrettyString(uid):entity} stopped suffocating"); _adminLogger.Add(LogType.Asphyxiation, $"{ToPrettyString(uid):entity} stopped suffocating");
_alertsSystem.ClearAlert(uid, AlertType.LowOxygen); _alertsSystem.ClearAlert(uid, AlertType.LowOxygen);

View File

@@ -36,7 +36,7 @@ public sealed class ChatSystem : SharedChatSystem
[Dependency] private readonly IAdminManager _adminManager = default!; [Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly AdminLogSystem _logs = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly ListeningSystem _listener = default!; [Dependency] private readonly ListeningSystem _listener = default!;
[Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly InventorySystem _inventory = default!;
@@ -155,7 +155,7 @@ public sealed class ChatSystem : SharedChatSystem
var ev = new EntitySpokeEvent(message); var ev = new EntitySpokeEvent(message);
RaiseLocalEvent(source, ev, false); RaiseLocalEvent(source, ev, false);
_logs.Add(LogType.Chat, LogImpact.Low, $"Say from {ToPrettyString(source):user}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Say from {ToPrettyString(source):user}: {message}");
} }
private void SendEntityWhisper(EntityUid source, string message, bool hideChat = false) private void SendEntityWhisper(EntityUid source, string message, bool hideChat = false)
@@ -199,7 +199,7 @@ public sealed class ChatSystem : SharedChatSystem
var ev = new EntitySpokeEvent(message); var ev = new EntitySpokeEvent(message);
RaiseLocalEvent(source, ev, false); RaiseLocalEvent(source, ev, false);
_logs.Add(LogType.Chat, LogImpact.Low, $"Whisper from {ToPrettyString(source):user}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Whisper from {ToPrettyString(source):user}: {message}");
} }
private void SendEntityEmote(EntityUid source, string action, bool hideChat) private void SendEntityEmote(EntityUid source, string action, bool hideChat)
@@ -210,7 +210,7 @@ public sealed class ChatSystem : SharedChatSystem
("entityName", Name(source))); ("entityName", Name(source)));
SendInVoiceRange(ChatChannel.Emotes, action, messageWrap, source, hideChat); SendInVoiceRange(ChatChannel.Emotes, action, messageWrap, source, hideChat);
_logs.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user}: {action}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user}: {action}");
} }
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
@@ -225,7 +225,7 @@ public sealed class ChatSystem : SharedChatSystem
("entityName", Name(source))); ("entityName", Name(source)));
SendInVoiceRange(ChatChannel.LOOC, message, messageWrap, source, hideChat); SendInVoiceRange(ChatChannel.LOOC, message, messageWrap, source, hideChat);
_logs.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}");
} }
private void SendDeadChat(EntityUid source, IPlayerSession player, string message, bool hideChat) private void SendDeadChat(EntityUid source, IPlayerSession player, string message, bool hideChat)
@@ -238,18 +238,18 @@ public sealed class ChatSystem : SharedChatSystem
messageWrap = Loc.GetString("chat-manager-send-admin-dead-chat-wrap-message", messageWrap = Loc.GetString("chat-manager-send-admin-dead-chat-wrap-message",
("adminChannelName", Loc.GetString("chat-manager-admin-channel-name")), ("adminChannelName", Loc.GetString("chat-manager-admin-channel-name")),
("userName", player.ConnectedClient.UserName)); ("userName", player.ConnectedClient.UserName));
_logs.Add(LogType.Chat, LogImpact.Low, $"Dead chat from {player:Player}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Dead chat from {player:Player}: {message}");
} }
else else
{ {
messageWrap = Loc.GetString("chat-manager-send-dead-chat-wrap-message", messageWrap = Loc.GetString("chat-manager-send-dead-chat-wrap-message",
("deadChannelName", Loc.GetString("chat-manager-dead-channel-name")), ("deadChannelName", Loc.GetString("chat-manager-dead-channel-name")),
("playerName", (playerName))); ("playerName", (playerName)));
_logs.Add(LogType.Chat, LogImpact.Low, $"Admin dead chat from {player:Player}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Admin dead chat from {player:Player}: {message}");
} }
_chatManager.ChatMessageToMany(ChatChannel.Dead, message, messageWrap, source, hideChat, clients.ToList()); _chatManager.ChatMessageToMany(ChatChannel.Dead, message, messageWrap, source, hideChat, clients.ToList());
_logs.Add(LogType.Chat, LogImpact.Low, $"Dead chat from {player:Player}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Dead chat from {player:Player}: {message}");
} }
#endregion #endregion

View File

@@ -32,11 +32,10 @@ namespace Content.Server.Chat.Managers
[Dependency] private readonly IServerNetManager _netManager = default!; [Dependency] private readonly IServerNetManager _netManager = default!;
[Dependency] private readonly IMoMMILink _mommiLink = default!; [Dependency] private readonly IMoMMILink _mommiLink = default!;
[Dependency] private readonly IAdminManager _adminManager = default!; [Dependency] private readonly IAdminManager _adminManager = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IServerPreferencesManager _preferencesManager = default!; [Dependency] private readonly IServerPreferencesManager _preferencesManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
private AdminLogSystem _logs = default!;
/// <summary> /// <summary>
/// The maximum length a player-sent message can be sent /// The maximum length a player-sent message can be sent
/// </summary> /// </summary>
@@ -47,7 +46,6 @@ namespace Content.Server.Chat.Managers
public void Initialize() public void Initialize()
{ {
_logs = EntitySystem.Get<AdminLogSystem>();
_netManager.RegisterNetMessage<MsgChatMessage>(); _netManager.RegisterNetMessage<MsgChatMessage>();
_configurationManager.OnValueChanged(CCVars.OocEnabled, OnOocEnabledChanged, true); _configurationManager.OnValueChanged(CCVars.OocEnabled, OnOocEnabledChanged, true);
@@ -78,7 +76,7 @@ namespace Content.Server.Chat.Managers
ChatMessageToAll(ChatChannel.Server, message, messageWrap, colorOverride); ChatMessageToAll(ChatChannel.Server, message, messageWrap, colorOverride);
Logger.InfoS("SERVER", message); Logger.InfoS("SERVER", message);
_logs.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server announcement: {message}");
} }
public void DispatchStationAnnouncement(string message, string sender = "Central Command", bool playDefaultSound = true, Color? colorOverride = null) public void DispatchStationAnnouncement(string message, string sender = "Central Command", bool playDefaultSound = true, Color? colorOverride = null)
@@ -90,7 +88,7 @@ namespace Content.Server.Chat.Managers
SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/announce.ogg", AudioParams.Default.WithVolume(-2f)); SoundSystem.Play(Filter.Broadcast(), "/Audio/Announcements/announce.ogg", AudioParams.Default.WithVolume(-2f));
} }
_logs.Add(LogType.Chat, LogImpact.Low, $"Station Announcement from {sender}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Station Announcement from {sender}: {message}");
} }
public void DispatchServerMessage(IPlayerSession player, string message) public void DispatchServerMessage(IPlayerSession player, string message)
@@ -98,7 +96,7 @@ namespace Content.Server.Chat.Managers
var messageWrap = Loc.GetString("chat-manager-server-wrap-message"); var messageWrap = Loc.GetString("chat-manager-server-wrap-message");
ChatMessageToOne(ChatChannel.Server, message, messageWrap, default, false, player.ConnectedClient); ChatMessageToOne(ChatChannel.Server, message, messageWrap, default, false, player.ConnectedClient);
_logs.Add(LogType.Chat, LogImpact.Low, $"Server message to {player:Player}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Server message to {player:Player}: {message}");
} }
public void SendAdminAnnouncement(string message) public void SendAdminAnnouncement(string message)
@@ -110,7 +108,7 @@ namespace Content.Server.Chat.Managers
("adminChannelName", Loc.GetString("chat-manager-admin-channel-name"))); ("adminChannelName", Loc.GetString("chat-manager-admin-channel-name")));
ChatMessageToMany(ChatChannel.Admin, message, messageWrap, default, false, clients.ToList()); ChatMessageToMany(ChatChannel.Admin, message, messageWrap, default, false, clients.ToList());
_logs.Add(LogType.Chat, LogImpact.Low, $"Admin announcement from {message}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Admin announcement from {message}: {message}");
} }
public void SendHookOOC(string sender, string message) public void SendHookOOC(string sender, string message)
@@ -122,7 +120,7 @@ namespace Content.Server.Chat.Managers
message = FormattedMessage.EscapeText(message); message = FormattedMessage.EscapeText(message);
var messageWrap = Loc.GetString("chat-manager-send-hook-ooc-wrap-message", ("senderName", sender)); var messageWrap = Loc.GetString("chat-manager-send-hook-ooc-wrap-message", ("senderName", sender));
ChatMessageToAll(ChatChannel.OOC, message, messageWrap); ChatMessageToAll(ChatChannel.OOC, message, messageWrap);
_logs.Add(LogType.Chat, LogImpact.Low, $"Hook OOC from {sender}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Hook OOC from {sender}: {message}");
} }
#endregion #endregion
@@ -191,14 +189,14 @@ namespace Content.Server.Chat.Managers
//TODO: player.Name color, this will need to change the structure of the MsgChatMessage //TODO: player.Name color, this will need to change the structure of the MsgChatMessage
ChatMessageToAll(ChatChannel.OOC, message, messageWrap, colorOverride); ChatMessageToAll(ChatChannel.OOC, message, messageWrap, colorOverride);
_mommiLink.SendOOCMessage(player.Name, message); _mommiLink.SendOOCMessage(player.Name, message);
_logs.Add(LogType.Chat, LogImpact.Low, $"OOC from {player:Player}: {message}"); _adminLogger.Add(LogType.Chat, LogImpact.Low, $"OOC from {player:Player}: {message}");
} }
private void SendAdminChat(IPlayerSession player, string message) private void SendAdminChat(IPlayerSession player, string message)
{ {
if (!_adminManager.IsAdmin(player)) if (!_adminManager.IsAdmin(player))
{ {
_logs.Add(LogType.Chat, LogImpact.Extreme, $"{player:Player} attempted to send admin message but was not admin"); _adminLogger.Add(LogType.Chat, LogImpact.Extreme, $"{player:Player} attempted to send admin message but was not admin");
return; return;
} }
@@ -208,7 +206,7 @@ namespace Content.Server.Chat.Managers
("playerName", player.Name)); ("playerName", player.Name));
ChatMessageToMany(ChatChannel.Admin, message, messageWrap, default, false, clients.ToList()); ChatMessageToMany(ChatChannel.Admin, message, messageWrap, default, false, clients.ToList());
_logs.Add(LogType.Chat, $"Admin chat from {player:Player}: {message}"); _adminLogger.Add(LogType.Chat, $"Admin chat from {player:Player}: {message}");
} }
#endregion #endregion

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Chat
{ {
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly EntityLookupSystem _entityLookupSystem = default!; [Dependency] private readonly EntityLookupSystem _entityLookupSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!;
@@ -35,7 +35,7 @@ namespace Content.Server.Chat
return false; return false;
} }
_adminLogSystem.Add(LogType.Suicide, _adminLogger.Add(LogType.Suicide,
$"{EntityManager.ToPrettyString(victim):player} is committing suicide"); $"{EntityManager.ToPrettyString(victim):player} is committing suicide");
var suicideEvent = new SuicideEvent(victim); var suicideEvent = new SuicideEvent(victim);

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.EntitySystems
var coordinates = Transform(owner).Coordinates; var coordinates = Transform(owner).Coordinates;
_logSystem.Add(LogType.ChemicalReaction, reaction.Impact, _adminLogger.Add(LogType.ChemicalReaction, reaction.Impact,
$"Chemical reaction {reaction.ID:reaction} occurred with strength {unitReactions:strength} on entity {ToPrettyString(owner):metabolizer} at {coordinates}"); $"Chemical reaction {reaction.ID:reaction} occurred with strength {unitReactions:strength} on entity {ToPrettyString(owner):metabolizer} at {coordinates}");
SoundSystem.Play(Filter.Pvs(owner, entityManager:EntityManager), reaction.Sound.GetSound(), owner); SoundSystem.Play(Filter.Pvs(owner, entityManager:EntityManager), reaction.Sound.GetSound(), owner);

View File

@@ -206,7 +206,7 @@ public sealed partial class ChemistrySystem
// Add an admin log, using the "force feed" log type. It's not quite feeding, but the effect is the same. // Add an admin log, using the "force feed" log type. It's not quite feeding, but the effect is the same.
if (component.ToggleState == SharedInjectorComponent.InjectorToggleMode.Inject) if (component.ToggleState == SharedInjectorComponent.InjectorToggleMode.Inject)
{ {
_logs.Add(LogType.ForceFeed, _adminLogger.Add(LogType.ForceFeed,
$"{EntityManager.ToPrettyString(user):user} is attempting to inject {EntityManager.ToPrettyString(target):target} with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}"); $"{EntityManager.ToPrettyString(user):user} is attempting to inject {EntityManager.ToPrettyString(target):target} with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}");
} }
} }
@@ -216,7 +216,7 @@ public sealed partial class ChemistrySystem
actualDelay /= 2; actualDelay /= 2;
if (component.ToggleState == SharedInjectorComponent.InjectorToggleMode.Inject) if (component.ToggleState == SharedInjectorComponent.InjectorToggleMode.Inject)
_logs.Add(LogType.Ingestion, _adminLogger.Add(LogType.Ingestion,
$"{EntityManager.ToPrettyString(user):user} is attempting to inject themselves with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}."); $"{EntityManager.ToPrettyString(user):user} is attempting to inject themselves with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}.");
} }

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Chemistry.EntitySystems;
public sealed partial class ChemistrySystem : EntitySystem public sealed partial class ChemistrySystem : EntitySystem
{ {
[Dependency] private readonly AdminLogSystem _logs = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly BloodstreamSystem _blood = default!; [Dependency] private readonly BloodstreamSystem _blood = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!; [Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;

View File

@@ -20,7 +20,7 @@ namespace Content.Server.CombatMode
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly MeleeWeaponSystem _meleeWeaponSystem = default!; [Dependency] private readonly MeleeWeaponSystem _meleeWeaponSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
public override void Initialize() public override void Initialize()
@@ -87,7 +87,7 @@ namespace Content.Server.CombatMode
_meleeWeaponSystem.SendAnimation("disarm", angle, args.Performer, args.Performer, new[] { args.Target }); _meleeWeaponSystem.SendAnimation("disarm", angle, args.Performer, args.Performer, new[] { args.Target });
SoundSystem.Play(filterAll, component.DisarmSuccessSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f)); SoundSystem.Play(filterAll, component.DisarmSuccessSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f));
_logSystem.Add(LogType.DisarmedAction, $"{ToPrettyString(args.Performer):user} used disarm on {ToPrettyString(args.Target):target}"); _adminLogger.Add(LogType.DisarmedAction, $"{ToPrettyString(args.Performer):user} used disarm on {ToPrettyString(args.Target):target}");
var eventArgs = new DisarmedEvent() { Target = args.Target, Source = args.Performer, PushProbability = component.DisarmPushChance }; var eventArgs = new DisarmedEvent() { Target = args.Target, Source = args.Performer, PushProbability = component.DisarmPushChance };
RaiseLocalEvent(args.Target, eventArgs); RaiseLocalEvent(args.Target, eventArgs);

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Construction
{ {
public sealed class AnchorableSystem : SharedAnchorableSystem public sealed class AnchorableSystem : SharedAnchorableSystem
{ {
[Dependency] private readonly AdminLogSystem _adminLogs = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly ToolSystem _toolSystem = default!; [Dependency] private readonly ToolSystem _toolSystem = default!;
[Dependency] private readonly PullingSystem _pullingSystem = default!; [Dependency] private readonly PullingSystem _pullingSystem = default!;
@@ -43,7 +43,7 @@ namespace Content.Server.Construction
RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, args.Using), false); RaiseLocalEvent(uid, new UserUnanchoredEvent(args.User, args.Using), false);
_adminLogs.Add( _adminLogger.Add(
LogType.Action, LogType.Action,
LogImpact.Low, LogImpact.Low,
$"{EntityManager.ToPrettyString(args.User):user} unanchored {EntityManager.ToPrettyString(uid):anchored} using {EntityManager.ToPrettyString(args.Using):using}" $"{EntityManager.ToPrettyString(args.User):user} unanchored {EntityManager.ToPrettyString(uid):anchored} using {EntityManager.ToPrettyString(args.Using):using}"
@@ -78,7 +78,7 @@ namespace Content.Server.Construction
RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, args.Using), false); RaiseLocalEvent(uid, new UserAnchoredEvent(args.User, args.Using), false);
_adminLogs.Add( _adminLogger.Add(
LogType.Action, LogType.Action,
LogImpact.Low, LogImpact.Low,
$"{EntityManager.ToPrettyString(args.User):user} anchored {EntityManager.ToPrettyString(uid):anchored} using {EntityManager.ToPrettyString(args.Using):using}" $"{EntityManager.ToPrettyString(args.User):user} anchored {EntityManager.ToPrettyString(uid):anchored} using {EntityManager.ToPrettyString(args.Using):using}"

View File

@@ -22,11 +22,11 @@ public sealed class AdminLog : IGraphAction
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager) public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{ {
var logSys = entityManager.EntitySysManager.GetEntitySystem<AdminLogSystem>(); var logManager = IoCManager.Resolve<IAdminLogManager>();
if (userUid.HasValue) if (userUid.HasValue)
logSys.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}, User: {entityManager.ToPrettyString(userUid.Value):user}"); logManager.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}, User: {entityManager.ToPrettyString(userUid.Value):user}");
else else
logSys.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}"); logManager.Add(LogType, Impact, $"{Message} - Entity: {entityManager.ToPrettyString(uid):entity}");
} }
} }

View File

@@ -20,7 +20,7 @@ namespace Content.Server.Crayon;
public sealed class CrayonSystem : SharedCrayonSystem public sealed class CrayonSystem : SharedCrayonSystem
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly AdminLogSystem _logs = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly DecalSystem _decals = default!; [Dependency] private readonly DecalSystem _decals = default!;
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
@@ -73,7 +73,7 @@ public sealed class CrayonSystem : SharedCrayonSystem
// Decrease "Ammo" // Decrease "Ammo"
component.Charges--; component.Charges--;
Dirty(component); Dirty(component);
_logs.Add(LogType.CrayonDraw, LogImpact.Low, $"{EntityManager.ToPrettyString(args.User):user} drew a {component.Color:color} {component.SelectedState}"); _adminLogger.Add(LogType.CrayonDraw, LogImpact.Low, $"{EntityManager.ToPrettyString(args.User):user} drew a {component.Color:color} {component.SelectedState}");
args.Handled = true; args.Handled = true;
if (component.DeleteEmpty && component.Charges <= 0) if (component.DeleteEmpty && component.Charges <= 0)

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Damage.Systems
public sealed class DamageOnToolInteractSystem : EntitySystem public sealed class DamageOnToolInteractSystem : EntitySystem
{ {
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
public override void Initialize() public override void Initialize()
{ {
@@ -33,7 +33,7 @@ namespace Content.Server.Damage.Systems
var dmg = _damageableSystem.TryChangeDamage(args.Target, weldingDamage); var dmg = _damageableSystem.TryChangeDamage(args.Target, weldingDamage);
if (dmg != null) if (dmg != null)
_logSystem.Add(LogType.Damaged, _adminLogger.Add(LogType.Damaged,
$"{ToPrettyString(args.User):user} used {ToPrettyString(args.Used):used} as a welder to deal {dmg.Total:damage} damage to {ToPrettyString(args.Target):target}"); $"{ToPrettyString(args.User):user} used {ToPrettyString(args.Used):used} as a welder to deal {dmg.Total:damage} damage to {ToPrettyString(args.Target):target}");
args.Handled = true; args.Handled = true;
@@ -45,7 +45,7 @@ namespace Content.Server.Damage.Systems
var dmg = _damageableSystem.TryChangeDamage(args.Target, damage); var dmg = _damageableSystem.TryChangeDamage(args.Target, damage);
if (dmg != null) if (dmg != null)
_logSystem.Add(LogType.Damaged, _adminLogger.Add(LogType.Damaged,
$"{ToPrettyString(args.User):user} used {ToPrettyString(args.Used):used} as a tool to deal {dmg.Total:damage} damage to {ToPrettyString(args.Target):target}"); $"{ToPrettyString(args.User):user} used {ToPrettyString(args.Used):used} as a tool to deal {dmg.Total:damage} damage to {ToPrettyString(args.Target):target}");
args.Handled = true; args.Handled = true;

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Damage.Systems
public sealed class DamageOtherOnHitSystem : EntitySystem public sealed class DamageOtherOnHitSystem : EntitySystem
{ {
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
public override void Initialize() public override void Initialize()
{ {
@@ -23,7 +23,7 @@ namespace Content.Server.Damage.Systems
// Log damage only for mobs. Useful for when people throw spears at each other, but also avoids log-spam when explosions send glass shards flying. // Log damage only for mobs. Useful for when people throw spears at each other, but also avoids log-spam when explosions send glass shards flying.
if (dmg != null && HasComp<MobStateComponent>(args.Target)) if (dmg != null && HasComp<MobStateComponent>(args.Target))
_logSystem.Add(LogType.ThrowHit, $"{ToPrettyString(args.Target):target} received {dmg.Total:damage} damage from collision"); _adminLogger.Add(LogType.ThrowHit, $"{ToPrettyString(args.Target):target} received {dmg.Total:damage} damage from collision");
} }
} }
} }

View File

@@ -41,7 +41,7 @@ namespace Content.Server.Electrocution
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!; [Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
[Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!;
private const string StatusEffectKey = "Electrocution"; private const string StatusEffectKey = "Electrocution";
@@ -105,7 +105,7 @@ namespace Content.Server.Electrocution
var actual = _damageableSystem.TryChangeDamage(finished.Electrocuting, damage); var actual = _damageableSystem.TryChangeDamage(finished.Electrocuting, damage);
if (actual != null) if (actual != null)
{ {
_logSystem.Add(LogType.Electrocution, _adminLogger.Add(LogType.Electrocution,
$"{ToPrettyString(finished.Owner):entity} received {actual.Total:damage} powered electrocution damage"); $"{ToPrettyString(finished.Owner):entity} received {actual.Total:damage} powered electrocution damage");
} }
} }
@@ -361,7 +361,7 @@ namespace Content.Server.Electrocution
if (actual != null) if (actual != null)
{ {
_logSystem.Add(LogType.Electrocution, _adminLogger.Add(LogType.Electrocution,
$"{ToPrettyString(statusEffects.Owner):entity} received {actual.Total:damage} powered electrocution damage"); $"{ToPrettyString(statusEffects.Owner):entity} received {actual.Total:damage} powered electrocution damage");
} }
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Server.Emag
public sealed class EmagSystem : EntitySystem public sealed class EmagSystem : EntitySystem
{ {
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _adminLog = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!;
@@ -66,7 +66,7 @@ namespace Content.Server.Emag
if (emaggedEvent.Handled) if (emaggedEvent.Handled)
{ {
_popupSystem.PopupEntity(Loc.GetString("emag-success", ("target", args.Target)), args.User, Filter.Entities(args.User)); _popupSystem.PopupEntity(Loc.GetString("emag-success", ("target", args.Target)), args.User, Filter.Entities(args.User));
_adminLog.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(args.User):player} emagged {ToPrettyString(args.Target.Value):target}"); _adminLogger.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(args.User):player} emagged {ToPrettyString(args.Target.Value):target}");
component.Charges--; component.Charges--;
return; return;
} }

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers; using Content.Server.Administration.Managers;
using Content.Server.Afk; using Content.Server.Afk;
using Content.Server.AI.Utility; using Content.Server.AI.Utility;
@@ -81,6 +82,7 @@ namespace Content.Server.Entry
logManager.GetSawmill("Storage").Level = LogLevel.Info; logManager.GetSawmill("Storage").Level = LogLevel.Info;
logManager.GetSawmill("db.ef").Level = LogLevel.Info; logManager.GetSawmill("db.ef").Level = LogLevel.Info;
IoCManager.Resolve<IAdminLogManager>().Initialize();
IoCManager.Resolve<IConnectionManager>().Initialize(); IoCManager.Resolve<IConnectionManager>().Initialize();
IoCManager.Resolve<IServerDbManager>().Init(); IoCManager.Resolve<IServerDbManager>().Init();
IoCManager.Resolve<IServerPreferencesManager>().Init(); IoCManager.Resolve<IServerPreferencesManager>().Init();

View File

@@ -33,7 +33,7 @@ public sealed partial class ExplosionSystem : EntitySystem
[Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!; [Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!;
[Dependency] private readonly CameraRecoilSystem _recoilSystem = default!; [Dependency] private readonly CameraRecoilSystem _recoilSystem = default!;
[Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly AdminLogSystem _logsSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly ThrowingSystem _throwingSystem = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!;
[Dependency] private readonly SharedTransformSystem _transformSystem = default!; [Dependency] private readonly SharedTransformSystem _transformSystem = default!;
@@ -213,10 +213,10 @@ public sealed partial class ExplosionSystem : EntitySystem
return; return;
if (user == null) if (user == null)
_logsSystem.Add(LogType.Explosion, LogImpact.High, _adminLogger.Add(LogType.Explosion, LogImpact.High,
$"{ToPrettyString(uid):entity} exploded at {pos:coordinates} with intensity {totalIntensity} slope {slope}"); $"{ToPrettyString(uid):entity} exploded at {pos:coordinates} with intensity {totalIntensity} slope {slope}");
else else
_logsSystem.Add(LogType.Explosion, LogImpact.High, _adminLogger.Add(LogType.Explosion, LogImpact.High,
$"{ToPrettyString(user.Value):user} caused {ToPrettyString(uid):entity} to explode at {pos:coordinates} with intensity {totalIntensity} slope {slope}"); $"{ToPrettyString(user.Value):user} caused {ToPrettyString(uid):entity} to explode at {pos:coordinates} with intensity {totalIntensity} slope {slope}");
} }
@@ -243,8 +243,8 @@ public sealed partial class ExplosionSystem : EntitySystem
} }
if (addLog) // dont log if already created a separate, more detailed, log. if (addLog) // dont log if already created a separate, more detailed, log.
_logsSystem.Add(LogType.Explosion, LogImpact.High, $"Explosion spawned at {epicenter:coordinates} with intensity {totalIntensity} slope {slope}"); _adminLogger.Add(LogType.Explosion, LogImpact.High, $"Explosion spawned at {epicenter:coordinates} with intensity {totalIntensity} slope {slope}");
_explosionQueue.Enqueue(() => SpawnExplosion(epicenter, type, totalIntensity, _explosionQueue.Enqueue(() => SpawnExplosion(epicenter, type, totalIntensity,
slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum)); slope, maxTileIntensity, tileBreakScale, maxTileBreak, canCreateVacuum));
} }

View File

@@ -38,7 +38,7 @@ namespace Content.Server.Explosion.EntitySystems
[Dependency] private readonly FixtureSystem _fixtures = default!; [Dependency] private readonly FixtureSystem _fixtures = default!;
[Dependency] private readonly FlashSystem _flashSystem = default!; [Dependency] private readonly FlashSystem _flashSystem = default!;
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!; [Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
public override void Initialize() public override void Initialize()
{ {
@@ -106,12 +106,12 @@ namespace Content.Server.Explosion.EntitySystems
if (user != null) if (user != null)
{ {
_logSystem.Add(LogType.Trigger, _adminLogger.Add(LogType.Trigger,
$"{ToPrettyString(user.Value):user} started a {delay} second timer trigger on entity {ToPrettyString(uid):timer}"); $"{ToPrettyString(user.Value):user} started a {delay} second timer trigger on entity {ToPrettyString(uid):timer}");
} }
else else
{ {
_logSystem.Add(LogType.Trigger, _adminLogger.Add(LogType.Trigger,
$"{delay} second timer trigger started on entity {ToPrettyString(uid):timer}"); $"{delay} second timer trigger started on entity {ToPrettyString(uid):timer}");
} }

View File

@@ -25,7 +25,7 @@ public sealed class SpillableSystem : EntitySystem
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
public override void Initialize() public override void Initialize()
{ {
@@ -84,7 +84,7 @@ public sealed class SpillableSystem : EntitySystem
if (args.User != null) if (args.User != null)
{ {
_logSystem.Add(LogType.Landed, _adminLogger.Add(LogType.Landed,
$"{ToPrettyString(uid):entity} spilled a solution {SolutionContainerSystem.ToPrettyString(solution):solution} on landing"); $"{ToPrettyString(uid):entity} spilled a solution {SolutionContainerSystem.ToPrettyString(solution):solution} on landing");
} }

View File

@@ -5,4 +5,10 @@
/// </summary> /// </summary>
public sealed class RoundStartingEvent : EntityEventArgs public sealed class RoundStartingEvent : EntityEventArgs
{ {
public RoundStartingEvent(int id)
{
Id = id;
}
public int Id { get; }
} }

View File

@@ -161,7 +161,7 @@ namespace Content.Server.GameTicking
return await _db.AddNewRound(server, playerIds); return await _db.AddNewRound(server, playerIds);
}).Result; }).Result;
var startingEvent = new RoundStartingEvent(); var startingEvent = new RoundStartingEvent(RoundId);
RaiseLocalEvent(startingEvent); RaiseLocalEvent(startingEvent);
List<IPlayerSession> readyPlayers; List<IPlayerSession> readyPlayers;

View File

@@ -179,9 +179,9 @@ namespace Content.Server.GameTicking
_stationJobs.TryAssignJob(station, jobPrototype); _stationJobs.TryAssignJob(station, jobPrototype);
if (lateJoin) if (lateJoin)
_adminLogSystem.Add(LogType.LateJoin, LogImpact.Medium, $"Player {player.Name} late joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {job.Name:jobName}."); _adminLogger.Add(LogType.LateJoin, LogImpact.Medium, $"Player {player.Name} late joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {job.Name:jobName}.");
else else
_adminLogSystem.Add(LogType.RoundStartJoin, LogImpact.Medium, $"Player {player.Name} joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {job.Name:jobName}."); _adminLogger.Add(LogType.RoundStartJoin, LogImpact.Medium, $"Player {player.Name} joined as {character.Name:characterName} on station {Name(station):stationName} with {ToPrettyString(mob):entity} as a {job.Name:jobName}.");
// Make sure they're aware of extended access. // Make sure they're aware of extended access.
if (Comp<StationJobsComponent>(station).ExtendedAccess if (Comp<StationJobsComponent>(station).ExtendedAccess
@@ -199,7 +199,7 @@ namespace Content.Server.GameTicking
public void Respawn(IPlayerSession player) public void Respawn(IPlayerSession player)
{ {
player.ContentData()?.WipeMind(); player.ContentData()?.WipeMind();
_adminLogSystem.Add(LogType.Respawn, LogImpact.Medium, $"Player {player} was respawned."); _adminLogger.Add(LogType.Respawn, LogImpact.Medium, $"Player {player} was respawned.");
if (LobbyEnabled) if (LobbyEnabled)
PlayerJoinLobby(player); PlayerJoinLobby(player);

View File

@@ -104,6 +104,7 @@ namespace Content.Server.GameTicking
[Dependency] private readonly IWatchdogApi _watchdogApi = default!; [Dependency] private readonly IWatchdogApi _watchdogApi = default!;
[Dependency] private readonly IGameMapManager _gameMapManager = default!; [Dependency] private readonly IGameMapManager _gameMapManager = default!;
[Dependency] private readonly IServerDbManager _db = default!; [Dependency] private readonly IServerDbManager _db = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IConsoleHost _consoleHost = default!; [Dependency] private readonly IConsoleHost _consoleHost = default!;
#if EXCEPTION_TOLERANCE #if EXCEPTION_TOLERANCE
@@ -112,7 +113,6 @@ namespace Content.Server.GameTicking
[Dependency] private readonly StationSystem _stationSystem = default!; [Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!; [Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
[Dependency] private readonly StationJobsSystem _stationJobs = default!; [Dependency] private readonly StationJobsSystem _stationJobs = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
[Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly GhostSystem _ghosts = default!; [Dependency] private readonly GhostSystem _ghosts = default!;
[Dependency] private readonly RoleBanManager _roleBanManager = default!; [Dependency] private readonly RoleBanManager _roleBanManager = default!;

View File

@@ -27,7 +27,7 @@ namespace Content.Server.Ghost.Roles
{ {
[Dependency] private readonly EuiManager _euiManager = default!; [Dependency] private readonly EuiManager _euiManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly FollowerSystem _followerSystem = default!; [Dependency] private readonly FollowerSystem _followerSystem = default!;
private uint _nextRoleIdentifier; private uint _nextRoleIdentifier;
@@ -182,7 +182,7 @@ namespace Content.Server.Ghost.Roles
if (!role.Take(player)) return; if (!role.Take(player)) return;
if (player.AttachedEntity != null) if (player.AttachedEntity != null)
_adminLogSystem.Add(LogType.GhostRoleTaken, LogImpact.Low, $"{player:player} took the {role.RoleName:roleName} ghost role {ToPrettyString(player.AttachedEntity.Value):entity}"); _adminLogger.Add(LogType.GhostRoleTaken, LogImpact.Low, $"{player:player} took the {role.RoleName:roleName} ghost role {ToPrettyString(player.AttachedEntity.Value):entity}");
CloseEui(player); CloseEui(player);
} }

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Interaction
{ {
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly PullingSystem _pullSystem = default!; [Dependency] private readonly PullingSystem _pullSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
public override void Initialize() public override void Initialize()
@@ -219,7 +219,7 @@ namespace Content.Server.Interaction
if (ev.Handled) if (ev.Handled)
{ {
_adminLogSystem.Add(LogType.AttackArmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked with {ToPrettyString(item.Value):used} at {coordinates}"); _adminLogger.Add(LogType.AttackArmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked with {ToPrettyString(item.Value):used} at {coordinates}");
return; return;
} }
} }
@@ -232,12 +232,12 @@ namespace Content.Server.Interaction
{ {
if (target != null) if (target != null)
{ {
_adminLogSystem.Add(LogType.AttackArmedClick, LogImpact.Low, _adminLogger.Add(LogType.AttackArmedClick, LogImpact.Low,
$"{ToPrettyString(user):user} attacked {ToPrettyString(target.Value):target} with {ToPrettyString(item.Value):used} at {coordinates}"); $"{ToPrettyString(user):user} attacked {ToPrettyString(target.Value):target} with {ToPrettyString(item.Value):used} at {coordinates}");
} }
else else
{ {
_adminLogSystem.Add(LogType.AttackArmedClick, LogImpact.Low, _adminLogger.Add(LogType.AttackArmedClick, LogImpact.Low,
$"{ToPrettyString(user):user} attacked with {ToPrettyString(item.Value):used} at {coordinates}"); $"{ToPrettyString(user):user} attacked with {ToPrettyString(item.Value):used} at {coordinates}");
} }
@@ -260,7 +260,7 @@ namespace Content.Server.Interaction
var ev = new WideAttackEvent(user, user, coordinates); var ev = new WideAttackEvent(user, user, coordinates);
RaiseLocalEvent(user, ev, false); RaiseLocalEvent(user, ev, false);
if (ev.Handled) if (ev.Handled)
_adminLogSystem.Add(LogType.AttackUnarmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked at {coordinates}"); _adminLogger.Add(LogType.AttackUnarmedWide, LogImpact.Low, $"{ToPrettyString(user):user} wide attacked at {coordinates}");
} }
else else
{ {
@@ -270,12 +270,12 @@ namespace Content.Server.Interaction
{ {
if (target != null) if (target != null)
{ {
_adminLogSystem.Add(LogType.AttackUnarmedClick, LogImpact.Low, _adminLogger.Add(LogType.AttackUnarmedClick, LogImpact.Low,
$"{ToPrettyString(user):user} attacked {ToPrettyString(target.Value):target} at {coordinates}"); $"{ToPrettyString(user):user} attacked {ToPrettyString(target.Value):target} at {coordinates}");
} }
else else
{ {
_adminLogSystem.Add(LogType.AttackUnarmedClick, LogImpact.Low, _adminLogger.Add(LogType.AttackUnarmedClick, LogImpact.Low,
$"{ToPrettyString(user):user} attacked at {coordinates}"); $"{ToPrettyString(user):user} attacked at {coordinates}");
} }
} }

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers; using Content.Server.Administration.Managers;
using Content.Server.Administration.Notes; using Content.Server.Administration.Notes;
using Content.Server.Afk; using Content.Server.Afk;
@@ -20,6 +21,7 @@ using Content.Server.Objectives.Interfaces;
using Content.Server.Preferences.Managers; using Content.Server.Preferences.Managers;
using Content.Server.Voting.Managers; using Content.Server.Voting.Managers;
using Content.Shared.Administration; using Content.Shared.Administration;
using Content.Shared.Administration.Logs;
using Content.Shared.Kitchen; using Content.Shared.Kitchen;
using Content.Shared.Module; using Content.Shared.Module;
@@ -54,6 +56,8 @@ namespace Content.Server.IoC
IoCManager.Register<NetworkResourceManager>(); IoCManager.Register<NetworkResourceManager>();
IoCManager.Register<IAdminNotesManager, AdminNotesManager>(); IoCManager.Register<IAdminNotesManager, AdminNotesManager>();
IoCManager.Register<GhostKickManager>(); IoCManager.Register<GhostKickManager>();
IoCManager.Register<ISharedAdminLogManager, AdminLogManager>();
IoCManager.Register<IAdminLogManager, AdminLogManager>();
} }
} }
} }

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Light.EntitySystems
[Dependency] private readonly SharedAmbientSoundSystem _ambientSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSystem = default!;
[Dependency] private readonly LightBulbSystem _bulbSystem = default!; [Dependency] private readonly LightBulbSystem _bulbSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SignalLinkerSystem _signalSystem = default!; [Dependency] private readonly SignalLinkerSystem _signalSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
@@ -111,7 +111,7 @@ namespace Content.Server.Light.EntitySystems
var damage = _damageableSystem.TryChangeDamage(userUid, light.Damage); var damage = _damageableSystem.TryChangeDamage(userUid, light.Damage);
if (damage != null) if (damage != null)
_logSystem.Add(LogType.Damaged, _adminLogger.Add(LogType.Damaged,
$"{ToPrettyString(args.User):user} burned their hand on {ToPrettyString(args.Target):target} and received {damage.Total:damage} damage"); $"{ToPrettyString(args.User):user} burned their hand on {ToPrettyString(args.Target):target} and received {damage.Total:damage} damage");
SoundSystem.Play(Filter.Pvs(uid), light.BurnHandSound.GetSound(), uid); SoundSystem.Play(Filter.Pvs(uid), light.BurnHandSound.GetSound(), uid);

View File

@@ -18,7 +18,7 @@ namespace Content.Server.Medical;
public sealed class HealingSystem : EntitySystem public sealed class HealingSystem : EntitySystem
{ {
[Dependency] private readonly AdminLogSystem _logs = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!; [Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!; [Dependency] private readonly DoAfterSystem _doAfter = default!;
@@ -59,9 +59,9 @@ public sealed class HealingSystem : EntitySystem
_stacks.Use(args.Component.Owner, 1, stack); _stacks.Use(args.Component.Owner, 1, stack);
if (uid != args.User) if (uid != args.User)
_logs.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(uid):target} for {healed.Total:damage} damage"); _adminLogger.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed {EntityManager.ToPrettyString(uid):target} for {healed.Total:damage} damage");
else else
_logs.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed themselves for {healed.Total:damage} damage"); _adminLogger.Add(LogType.Healed, $"{EntityManager.ToPrettyString(args.User):user} healed themselves for {healed.Total:damage} damage");
if (args.Component.HealingEndSound != null) if (args.Component.HealingEndSound != null)
{ {

View File

@@ -196,10 +196,11 @@ namespace Content.Server.Nutrition.Components
// _trySound(calculatedThreshold); // _trySound(calculatedThreshold);
if (calculatedHungerThreshold != _currentHungerThreshold) if (calculatedHungerThreshold != _currentHungerThreshold)
{ {
var logManager = IoCManager.Resolve<IAdminLogManager>();
if (_currentHungerThreshold == HungerThreshold.Dead) if (_currentHungerThreshold == HungerThreshold.Dead)
EntitySystem.Get<AdminLogSystem>().Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has stopped starving"); logManager.Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has stopped starving");
else if (calculatedHungerThreshold == HungerThreshold.Dead) else if (calculatedHungerThreshold == HungerThreshold.Dead)
EntitySystem.Get<AdminLogSystem>().Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has started starving"); logManager.Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has started starving");
_currentHungerThreshold = calculatedHungerThreshold; _currentHungerThreshold = calculatedHungerThreshold;
HungerThresholdEffect(); HungerThresholdEffect();

View File

@@ -37,7 +37,7 @@ namespace Content.Server.Nutrition.EntitySystems
[Dependency] private readonly BodySystem _bodySystem = default!; [Dependency] private readonly BodySystem _bodySystem = default!;
[Dependency] private readonly StomachSystem _stomachSystem = default!; [Dependency] private readonly StomachSystem _stomachSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SpillableSystem _spillableSystem = default!; [Dependency] private readonly SpillableSystem _spillableSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
@@ -227,7 +227,7 @@ namespace Content.Server.Nutrition.EntitySystems
user, Filter.Entities(target)); user, Filter.Entities(target));
// logging // logging
_logSystem.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to drink {ToPrettyString(drink.Owner):drink} {SolutionContainerSystem.ToPrettyString(drinkSolution)}"); _adminLogger.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to drink {ToPrettyString(drink.Owner):drink} {SolutionContainerSystem.ToPrettyString(drinkSolution)}");
} }
drink.CancelToken = new CancellationTokenSource(); drink.CancelToken = new CancellationTokenSource();

View File

@@ -34,7 +34,7 @@ namespace Content.Server.Nutrition.EntitySystems
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly UtensilSystem _utensilSystem = default!; [Dependency] private readonly UtensilSystem _utensilSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
@@ -121,7 +121,7 @@ namespace Content.Server.Nutrition.EntitySystems
user, Filter.Entities(target)); user, Filter.Entities(target));
// logging // logging
_logSystem.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to eat {ToPrettyString(food.Owner):food} {SolutionContainerSystem.ToPrettyString(foodSolution)}"); _adminLogger.Add(LogType.ForceFeed, LogImpact.Medium, $"{ToPrettyString(user):user} is forcing {ToPrettyString(target):target} to eat {ToPrettyString(food.Owner):food} {SolutionContainerSystem.ToPrettyString(foodSolution)}");
} }
var moveBreak = user != target; var moveBreak = user != target;
@@ -290,9 +290,9 @@ namespace Content.Server.Nutrition.EntitySystems
// logging // logging
if (user == null) if (user == null)
_logSystem.Add(LogType.ForceFeed, $"{ToPrettyString(uid):food} {SolutionContainerSystem.ToPrettyString(foodSolution):solution} was thrown into the mouth of {ToPrettyString(target):target}"); _adminLogger.Add(LogType.ForceFeed, $"{ToPrettyString(uid):food} {SolutionContainerSystem.ToPrettyString(foodSolution):solution} was thrown into the mouth of {ToPrettyString(target):target}");
else else
_logSystem.Add(LogType.ForceFeed, $"{ToPrettyString(user.Value):user} threw {ToPrettyString(uid):food} {SolutionContainerSystem.ToPrettyString(foodSolution):solution} into the mouth of {ToPrettyString(target):target}"); _adminLogger.Add(LogType.ForceFeed, $"{ToPrettyString(user.Value):user} threw {ToPrettyString(uid):food} {SolutionContainerSystem.ToPrettyString(foodSolution):solution} into the mouth of {ToPrettyString(target):target}");
var filter = user == null ? Filter.Entities(target) : Filter.Entities(target, user.Value); var filter = user == null ? Filter.Entities(target) : Filter.Entities(target, user.Value);
_popupSystem.PopupEntity(Loc.GetString(food.EatMessage, ("food", food.Owner)), target, filter); _popupSystem.PopupEntity(Loc.GetString(food.EatMessage, ("food", food.Owner)), target, filter);

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Nutrition.EntitySystems
{ {
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly AlertsSystem _alerts = default!; [Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly AdminLogSystem _adminlog = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly DamageableSystem _damage = default!; [Dependency] private readonly DamageableSystem _damage = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!; [Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
@@ -136,9 +136,9 @@ namespace Content.Server.Nutrition.EntitySystems
if (calculatedThirstThreshold != component.CurrentThirstThreshold) if (calculatedThirstThreshold != component.CurrentThirstThreshold)
{ {
if (component.CurrentThirstThreshold == ThirstThreshold.Dead) if (component.CurrentThirstThreshold == ThirstThreshold.Dead)
_adminlog.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has stopped taking dehydration damage"); _adminLogger.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has stopped taking dehydration damage");
else if (calculatedThirstThreshold == ThirstThreshold.Dead) else if (calculatedThirstThreshold == ThirstThreshold.Dead)
_adminlog.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has started taking dehydration damage"); _adminLogger.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has started taking dehydration damage");
component.CurrentThirstThreshold = calculatedThirstThreshold; component.CurrentThirstThreshold = calculatedThirstThreshold;
UpdateEffects(component); UpdateEffects(component);

View File

@@ -15,7 +15,7 @@ public sealed class PayloadSystem : EntitySystem
{ {
[Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
[Dependency] private readonly IComponentFactory _componentFactory = default!; [Dependency] private readonly IComponentFactory _componentFactory = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!; [Dependency] private readonly ISerializationManager _serializationManager = default!;
@@ -123,7 +123,7 @@ public sealed class PayloadSystem : EntitySystem
var solStringA = SolutionContainerSystem.ToPrettyString(solutionA); var solStringA = SolutionContainerSystem.ToPrettyString(solutionA);
var solStringB = SolutionContainerSystem.ToPrettyString(solutionB); var solStringB = SolutionContainerSystem.ToPrettyString(solutionB);
_logSystem.Add(LogType.ChemicalReaction, _adminLogger.Add(LogType.ChemicalReaction,
$"Chemical bomb payload {ToPrettyString(uid):payload} at {Transform(uid).MapPosition:location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}"); $"Chemical bomb payload {ToPrettyString(uid):payload} at {Transform(uid).MapPosition:location} is combining two solutions: {solStringA:solutionA} and {solStringB:solutionB}");
solutionA.MaxVolume += solutionB.MaxVolume; solutionA.MaxVolume += solutionB.MaxVolume;

View File

@@ -17,7 +17,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
{ {
[Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!;
[Dependency] private readonly ExplosionSystem _explosionSystem = default!; [Dependency] private readonly ExplosionSystem _explosionSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
public override void Initialize() public override void Initialize()
@@ -82,7 +82,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
private void Explode(EntityUid uid, BatteryComponent? battery = null) private void Explode(EntityUid uid, BatteryComponent? battery = null)
{ {
_logSystem.Add(LogType.Explosion, LogImpact.High, $"Sabotaged power cell {ToPrettyString(uid)} is exploding"); _adminLogger.Add(LogType.Explosion, LogImpact.High, $"Sabotaged power cell {ToPrettyString(uid)} is exploding");
if (!Resolve(uid, ref battery)) if (!Resolve(uid, ref battery))
return; return;
@@ -112,7 +112,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
if (component.IsRigged) if (component.IsRigged)
{ {
_logSystem.Add(LogType.Explosion, LogImpact.Medium, $"Power cell {ToPrettyString(uid)} has been rigged up to explode when used."); _adminLogger.Add(LogType.Explosion, LogImpact.Medium, $"Power cell {ToPrettyString(uid)} has been rigged up to explode when used.");
} }
} }

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Projectiles
public sealed class ProjectileSystem : SharedProjectileSystem public sealed class ProjectileSystem : SharedProjectileSystem
{ {
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly CameraRecoilSystem _cameraRecoil = default!; [Dependency] private readonly CameraRecoilSystem _cameraRecoil = default!;
[Dependency] private readonly GunSystem _guns = default!; [Dependency] private readonly GunSystem _guns = default!;
@@ -46,7 +46,7 @@ namespace Content.Server.Projectiles
if (modifiedDamage is not null && EntityManager.EntityExists(component.Shooter)) if (modifiedDamage is not null && EntityManager.EntityExists(component.Shooter))
{ {
_adminLogSystem.Add(LogType.BulletHit, _adminLogger.Add(LogType.BulletHit,
HasComp<ActorComponent>(otherEntity) ? LogImpact.Extreme : LogImpact.High, HasComp<ActorComponent>(otherEntity) ? LogImpact.Extreme : LogImpact.High,
$"Projectile {ToPrettyString(component.Owner):projectile} shot by {ToPrettyString(component.Shooter):user} hit {ToPrettyString(otherEntity):target} and dealt {modifiedDamage.Total:damage} damage"); $"Projectile {ToPrettyString(component.Owner):projectile} shot by {ToPrettyString(component.Shooter):user} hit {ToPrettyString(otherEntity):target} and dealt {modifiedDamage.Total:damage} damage");
} }

View File

@@ -20,7 +20,7 @@ namespace Content.Server.RCD.Systems
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly AdminLogSystem _logs = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly PopupSystem _popup = default!; [Dependency] private readonly PopupSystem _popup = default!;
@@ -114,20 +114,20 @@ namespace Content.Server.RCD.Systems
//Floor mode just needs the tile to be a space tile (subFloor) //Floor mode just needs the tile to be a space tile (subFloor)
case RcdMode.Floors: case RcdMode.Floors:
mapGrid.SetTile(snapPos, new Tile(_tileDefinitionManager["floor_steel"].TileId)); mapGrid.SetTile(snapPos, new Tile(_tileDefinitionManager["floor_steel"].TileId));
_logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridIndex} {snapPos} to floor_steel"); _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridIndex} {snapPos} to floor_steel");
break; break;
//We don't want to place a space tile on something that's already a space tile. Let's do the inverse of the last check. //We don't want to place a space tile on something that's already a space tile. Let's do the inverse of the last check.
case RcdMode.Deconstruct: case RcdMode.Deconstruct:
if (!tile.IsBlockedTurf(true)) //Delete the turf if (!tile.IsBlockedTurf(true)) //Delete the turf
{ {
mapGrid.SetTile(snapPos, Tile.Empty); mapGrid.SetTile(snapPos, Tile.Empty);
_logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridIndex} tile: {snapPos} to space"); _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to set grid: {tile.GridIndex} tile: {snapPos} to space");
} }
else //Delete what the user targeted else //Delete what the user targeted
{ {
if (args.Target is {Valid: true} target) if (args.Target is {Valid: true} target)
{ {
_logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to delete {ToPrettyString(target):target}"); _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to delete {ToPrettyString(target):target}");
QueueDel(target); QueueDel(target);
} }
} }
@@ -137,12 +137,12 @@ namespace Content.Server.RCD.Systems
case RcdMode.Walls: case RcdMode.Walls:
var ent = EntityManager.SpawnEntity("WallSolid", mapGrid.GridTileToLocal(snapPos)); var ent = EntityManager.SpawnEntity("WallSolid", mapGrid.GridTileToLocal(snapPos));
Transform(ent).LocalRotation = Angle.Zero; // Walls always need to point south. Transform(ent).LocalRotation = Angle.Zero; // Walls always need to point south.
_logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(ent)} at {snapPos} on grid {mapGrid.Index}"); _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(ent)} at {snapPos} on grid {mapGrid.Index}");
break; break;
case RcdMode.Airlock: case RcdMode.Airlock:
var airlock = EntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos)); var airlock = EntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos));
Transform(airlock).LocalRotation = Transform(rcd.Owner).LocalRotation; //Now apply icon smoothing. Transform(airlock).LocalRotation = Transform(rcd.Owner).LocalRotation; //Now apply icon smoothing.
_logs.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(airlock)} at {snapPos} on grid {mapGrid.Index}"); _adminLogger.Add(LogType.RCD, LogImpact.High, $"{ToPrettyString(args.User):user} used RCD to spawn {ToPrettyString(airlock)} at {snapPos} on grid {mapGrid.Index}");
break; break;
default: default:
args.Handled = true; args.Handled = true;

View File

@@ -11,7 +11,7 @@ namespace Content.Server.Repairable
{ {
[Dependency] private readonly ToolSystem _toolSystem = default!; [Dependency] private readonly ToolSystem _toolSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
public override void Initialize() public override void Initialize()
{ {
@@ -31,13 +31,13 @@ namespace Content.Server.Repairable
if (component.Damage != null) if (component.Damage != null)
{ {
var damageChanged = _damageableSystem.TryChangeDamage(uid, component.Damage, true, false); var damageChanged = _damageableSystem.TryChangeDamage(uid, component.Damage, true, false);
_logSystem.Add(LogType.Healed, $"{ToPrettyString(args.User):user} repaired {ToPrettyString(uid):target} by {damageChanged?.Total}"); _adminLogger.Add(LogType.Healed, $"{ToPrettyString(args.User):user} repaired {ToPrettyString(uid):target} by {damageChanged?.Total}");
} }
else else
{ {
// Repair all damage // Repair all damage
_damageableSystem.SetAllDamage(damageable, 0); _damageableSystem.SetAllDamage(damageable, 0);
_logSystem.Add(LogType.Healed, $"{ToPrettyString(args.User):user} repaired {ToPrettyString(uid):target} back to full health"); _adminLogger.Add(LogType.Healed, $"{ToPrettyString(args.User):user} repaired {ToPrettyString(uid):target} back to full health");
} }

View File

@@ -17,7 +17,7 @@ namespace Content.Server.RoundEnd
[Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly GameTicker _gameTicker = default!; [Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly AdminLogSystem _adminLog = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
public TimeSpan DefaultCooldownDuration { get; set; } = TimeSpan.FromSeconds(30); public TimeSpan DefaultCooldownDuration { get; set; } = TimeSpan.FromSeconds(30);
@@ -73,11 +73,11 @@ namespace Content.Server.RoundEnd
if (requester != null) if (requester != null)
{ {
_adminLog.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called by {ToPrettyString(requester.Value):user}"); _adminLogger.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called by {ToPrettyString(requester.Value):user}");
} }
else else
{ {
_adminLog.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called"); _adminLogger.Add(LogType.ShuttleCalled, LogImpact.High, $"Shuttle called");
} }
_chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-called-announcement",("minutes", countdownTime.Minutes)), Loc.GetString("Station"), false, Color.Gold); _chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-called-announcement",("minutes", countdownTime.Minutes)), Loc.GetString("Station"), false, Color.Gold);
@@ -102,11 +102,11 @@ namespace Content.Server.RoundEnd
if (requester != null) if (requester != null)
{ {
_adminLog.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled by {ToPrettyString(requester.Value):user}"); _adminLogger.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled by {ToPrettyString(requester.Value):user}");
} }
else else
{ {
_adminLog.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled"); _adminLogger.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled");
} }
_chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-recalled-announcement"), _chatManager.DispatchStationAnnouncement(Loc.GetString("round-end-system-shuttle-recalled-announcement"),

View File

@@ -24,7 +24,7 @@ namespace Content.Server.Singularity.EntitySystems
public sealed class EmitterSystem : EntitySystem public sealed class EmitterSystem : EntitySystem
{ {
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly AdminLogSystem _adminLog = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -56,7 +56,7 @@ namespace Content.Server.Singularity.EntitySystems
component.Owner.PopupMessage(args.User, Loc.GetString("comp-emitter-turned-off", ("target", component.Owner))); component.Owner.PopupMessage(args.User, Loc.GetString("comp-emitter-turned-off", ("target", component.Owner)));
} }
_adminLog.Add(LogType.Emitter, _adminLogger.Add(LogType.Emitter,
component.IsOn ? LogImpact.Medium : LogImpact.High, component.IsOn ? LogImpact.Medium : LogImpact.High,
$"{ToPrettyString(args.User):player} toggled {ToPrettyString(uid):emitter}"); $"{ToPrettyString(args.User):player} toggled {ToPrettyString(uid):emitter}");
} }

View File

@@ -125,7 +125,7 @@ namespace Content.Server.StationEvents.Events
Occurrences += 1; Occurrences += 1;
LastRun = EntitySystem.Get<GameTicker>().RoundDuration(); LastRun = EntitySystem.Get<GameTicker>().RoundDuration();
EntitySystem.Get<AdminLogSystem>() IoCManager.Resolve<IAdminLogManager>()
.Add(LogType.EventStarted, LogImpact.High, $"Event startup: {Name}"); .Add(LogType.EventStarted, LogImpact.High, $"Event startup: {Name}");
} }
@@ -135,7 +135,7 @@ namespace Content.Server.StationEvents.Events
/// </summary> /// </summary>
public virtual void Announce() public virtual void Announce()
{ {
EntitySystem.Get<AdminLogSystem>() IoCManager.Resolve<IAdminLogManager>()
.Add(LogType.EventAnnounced, $"Event announce: {Name}"); .Add(LogType.EventAnnounced, $"Event announce: {Name}");
if (StartAnnouncement != null) if (StartAnnouncement != null)
@@ -158,7 +158,7 @@ namespace Content.Server.StationEvents.Events
/// </summary> /// </summary>
public virtual void Shutdown() public virtual void Shutdown()
{ {
EntitySystem.Get<AdminLogSystem>() IoCManager.Resolve<IAdminLogManager>()
.Add(LogType.EventStopped, $"Event shutdown: {Name}"); .Add(LogType.EventStopped, $"Event shutdown: {Name}");
if (EndAnnouncement != null) if (EndAnnouncement != null)

View File

@@ -28,7 +28,7 @@ namespace Content.Server.StationEvents
[Dependency] private readonly GameTicker _gameTicker = default!; [Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly AdminLogSystem _adminLog = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
public StationEvent? CurrentEvent { get; private set; } public StationEvent? CurrentEvent { get; private set; }
public IReadOnlyCollection<StationEvent> StationEvents => _stationEvents; public IReadOnlyCollection<StationEvent> StationEvents => _stationEvents;
@@ -72,7 +72,7 @@ namespace Content.Server.StationEvents
/// <returns></returns> /// <returns></returns>
public string RunEvent(string name) public string RunEvent(string name)
{ {
_adminLog.Add(LogType.EventRan, LogImpact.High, $"Event run: {name}"); _adminLogger.Add(LogType.EventRan, LogImpact.High, $"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

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Stunnable
public sealed class StunSystem : SharedStunSystem public sealed class StunSystem : SharedStunSystem
{ {
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -42,7 +42,7 @@ namespace Content.Server.Stunnable
source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", Name(source)), ("target", Name(target)))); source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", Name(source)), ("target", Name(target))));
source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", Name(target)))); source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", Name(target))));
_adminLogSystem.Add(LogType.DisarmedKnockdown, LogImpact.Medium, $"{ToPrettyString(args.Source):user} knocked down {ToPrettyString(args.Target):target}"); _adminLogger.Add(LogType.DisarmedKnockdown, LogImpact.Medium, $"{ToPrettyString(args.Source):user} knocked down {ToPrettyString(args.Target):target}");
args.Handled = true; args.Handled = true;
} }

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Temperature.Systems
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!; [Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger= default!;
/// <summary> /// <summary>
/// All the components that will have their damage updated at the end of the tick. /// All the components that will have their damage updated at the end of the tick.
@@ -163,7 +163,7 @@ namespace Content.Server.Temperature.Systems
{ {
if (!temperature.TakingDamage) if (!temperature.TakingDamage)
{ {
_logSystem.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} started taking high temperature damage"); _adminLogger.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} started taking high temperature damage");
temperature.TakingDamage = true; temperature.TakingDamage = true;
} }
@@ -175,7 +175,7 @@ namespace Content.Server.Temperature.Systems
{ {
if (!temperature.TakingDamage) if (!temperature.TakingDamage)
{ {
_logSystem.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} started taking low temperature damage"); _adminLogger.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} started taking low temperature damage");
temperature.TakingDamage = true; temperature.TakingDamage = true;
} }
@@ -186,7 +186,7 @@ namespace Content.Server.Temperature.Systems
} }
else if (temperature.TakingDamage) else if (temperature.TakingDamage)
{ {
_logSystem.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} stopped taking temperature damage"); _adminLogger.Add(LogType.Temperature, $"{ToPrettyString(temperature.Owner):entity} stopped taking temperature damage");
temperature.TakingDamage = false; temperature.TakingDamage = false;
} }
} }

View File

@@ -13,7 +13,7 @@ namespace Content.Server.Verbs
{ {
public sealed class VerbSystem : SharedVerbSystem public sealed class VerbSystem : SharedVerbSystem
{ {
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IAdminManager _adminMgr = default!; [Dependency] private readonly IAdminManager _adminMgr = default!;
@@ -118,12 +118,12 @@ namespace Content.Server.Verbs
if (holding == null) if (holding == null)
{ {
_logSystem.Add(LogType.Verb, verb.Impact, _adminLogger.Add(LogType.Verb, verb.Impact,
$"{ToPrettyString(user):user} {executionText} the [{verbText:verb}] verb targeting {ToPrettyString(target):target}"); $"{ToPrettyString(user):user} {executionText} the [{verbText:verb}] verb targeting {ToPrettyString(target):target}");
} }
else else
{ {
_logSystem.Add(LogType.Verb, verb.Impact, _adminLogger.Add(LogType.Verb, verb.Impact,
$"{ToPrettyString(user):user} {executionText} the [{verbText:verb}] verb targeting {ToPrettyString(target):target} while holding {ToPrettyString(holding.Value):held}"); $"{ToPrettyString(user):user} {executionText} the [{verbText:verb}] verb targeting {ToPrettyString(target):target} while holding {ToPrettyString(holding.Value):held}");
} }
} }

View File

@@ -30,7 +30,7 @@ namespace Content.Server.Weapon.Melee
[Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!; [Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
public const float DamagePitchVariation = 0.15f; public const float DamagePitchVariation = 0.15f;
@@ -100,10 +100,10 @@ namespace Content.Server.Weapon.Melee
if (damageResult != null) if (damageResult != null)
{ {
if (args.Used == args.User) if (args.Used == args.User)
_logSystem.Add(LogType.MeleeHit, _adminLogger.Add(LogType.MeleeHit,
$"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(args.Target.Value):target} using their hands and dealt {damageResult.Total:damage} damage"); $"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(args.Target.Value):target} using their hands and dealt {damageResult.Total:damage} damage");
else else
_logSystem.Add(LogType.MeleeHit, _adminLogger.Add(LogType.MeleeHit,
$"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(args.Target.Value):target} using {ToPrettyString(args.Used):used} and dealt {damageResult.Total:damage} damage"); $"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(args.Target.Value):target} using {ToPrettyString(args.Used):used} and dealt {damageResult.Total:damage} damage");
} }
@@ -181,10 +181,10 @@ namespace Content.Server.Weapon.Melee
if (damageResult != null) if (damageResult != null)
{ {
if (args.Used == args.User) if (args.Used == args.User)
_logSystem.Add(LogType.MeleeHit, _adminLogger.Add(LogType.MeleeHit,
$"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(entity):target} using their hands and dealt {damageResult.Total:damage} damage"); $"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(entity):target} using their hands and dealt {damageResult.Total:damage} damage");
else else
_logSystem.Add(LogType.MeleeHit, _adminLogger.Add(LogType.MeleeHit,
$"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(entity):target} using {ToPrettyString(args.Used):used} and dealt {damageResult.Total:damage} damage"); $"{ToPrettyString(args.User):user} melee attacked {ToPrettyString(entity):target} using {ToPrettyString(args.Used):used} and dealt {damageResult.Total:damage} damage");
} }
} }

View File

@@ -245,7 +245,7 @@ public sealed partial class GunSystem
hitscan.FireEffects(shooter, distance, angle, result.HitEntity); hitscan.FireEffects(shooter, distance, angle, result.HitEntity);
var modifiedDamage = _damageable.TryChangeDamage(result.HitEntity, hitscan.Damage); var modifiedDamage = _damageable.TryChangeDamage(result.HitEntity, hitscan.Damage);
if (modifiedDamage != null) if (modifiedDamage != null)
_logs.Add(LogType.HitScanHit, _adminLogger.Add(LogType.HitScanHit,
$"{EntityManager.ToPrettyString(shooter):user} hit {EntityManager.ToPrettyString(result.HitEntity):target} using {EntityManager.ToPrettyString(hitscan.Owner):used} and dealt {modifiedDamage.Total:damage} damage"); $"{EntityManager.ToPrettyString(shooter):user} hit {EntityManager.ToPrettyString(result.HitEntity):target} using {EntityManager.ToPrettyString(hitscan.Owner):used} and dealt {modifiedDamage.Total:damage} damage");
PlaySound(rayCastResults[0].HitEntity, modifiedDamage, hitscan.SoundHit, hitscan.ForceSound); PlaySound(rayCastResults[0].HitEntity, modifiedDamage, hitscan.SoundHit, hitscan.ForceSound);

View File

@@ -35,7 +35,7 @@ public sealed partial class GunSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ActionBlockerSystem _blocker = default!; [Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly AdminLogSystem _logs = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AtmosphereSystem _atmos = default!; [Dependency] private readonly AtmosphereSystem _atmos = default!;
[Dependency] private readonly CameraRecoilSystem _recoil = default!; [Dependency] private readonly CameraRecoilSystem _recoil = default!;
[Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly DamageableSystem _damageable = default!;

View File

@@ -19,7 +19,7 @@ namespace Content.Shared.Actions;
public abstract class SharedActionsSystem : EntitySystem public abstract class SharedActionsSystem : EntitySystem
{ {
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
@@ -113,7 +113,7 @@ public abstract class SharedActionsSystem : EntitySystem
// Does the user actually have the requested action? // Does the user actually have the requested action?
if (!component.Actions.TryGetValue(ev.Action, out var act)) if (!component.Actions.TryGetValue(ev.Action, out var act))
{ {
_logSystem.Add(LogType.Action, _adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} attempted to perform an action that they do not have: {ev.Action.Name}."); $"{ToPrettyString(user):user} attempted to perform an action that they do not have: {ev.Action.Name}.");
return; return;
} }
@@ -146,10 +146,10 @@ public abstract class SharedActionsSystem : EntitySystem
return; return;
if (act.Provider == null) if (act.Provider == null)
_logSystem.Add(LogType.Action, _adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action targeted at {ToPrettyString(entityTarget):target}."); $"{ToPrettyString(user):user} is performing the {name:action} action targeted at {ToPrettyString(entityTarget):target}.");
else else
_logSystem.Add(LogType.Action, _adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action (provided by {ToPrettyString(act.Provider.Value):provider}) targeted at {ToPrettyString(entityTarget):target}."); $"{ToPrettyString(user):user} is performing the {name:action} action (provided by {ToPrettyString(act.Provider.Value):provider}) targeted at {ToPrettyString(entityTarget):target}.");
if (entityAction.Event != null) if (entityAction.Event != null)
@@ -174,10 +174,10 @@ public abstract class SharedActionsSystem : EntitySystem
return; return;
if (act.Provider == null) if (act.Provider == null)
_logSystem.Add(LogType.Action, _adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action targeted at {mapTarget:target}."); $"{ToPrettyString(user):user} is performing the {name:action} action targeted at {mapTarget:target}.");
else else
_logSystem.Add(LogType.Action, _adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action (provided by {ToPrettyString(act.Provider.Value):provider}) targeted at {mapTarget:target}."); $"{ToPrettyString(user):user} is performing the {name:action} action (provided by {ToPrettyString(act.Provider.Value):provider}) targeted at {mapTarget:target}.");
if (worldAction.Event != null) if (worldAction.Event != null)
@@ -194,10 +194,10 @@ public abstract class SharedActionsSystem : EntitySystem
return; return;
if (act.Provider == null) if (act.Provider == null)
_logSystem.Add(LogType.Action, _adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action."); $"{ToPrettyString(user):user} is performing the {name:action} action.");
else else
_logSystem.Add(LogType.Action, _adminLogger.Add(LogType.Action,
$"{ToPrettyString(user):user} is performing the {name:action} action provided by {ToPrettyString(act.Provider.Value):provider}."); $"{ToPrettyString(user):user} is performing the {name:action} action provided by {ToPrettyString(act.Provider.Value):provider}.");
performEvent = instantAction.Event; performEvent = instantAction.Event;

View File

@@ -0,0 +1,10 @@
using Content.Shared.Database;
namespace Content.Shared.Administration.Logs;
public interface ISharedAdminLogManager
{
void Add(LogType type, LogImpact impact, ref LogStringHandler handler);
void Add(LogType type, ref LogStringHandler handler);
}

View File

@@ -0,0 +1,17 @@
using Content.Shared.Database;
namespace Content.Shared.Administration.Logs;
[Virtual]
public class SharedAdminLogManager : ISharedAdminLogManager
{
public virtual void Add(LogType type, LogImpact impact, ref LogStringHandler handler)
{
// noop
}
public virtual void Add(LogType type, ref LogStringHandler handler)
{
// noop
}
}

View File

@@ -20,7 +20,7 @@ namespace Content.Shared.Chemistry.Reaction
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] protected readonly SharedAdminLogSystem _logSystem = default!; [Dependency] protected readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly IGamePrototypeLoadManager _gamePrototypeLoadManager = default!; [Dependency] private readonly IGamePrototypeLoadManager _gamePrototypeLoadManager = default!;
/// <summary> /// <summary>
@@ -202,7 +202,7 @@ namespace Content.Shared.Chemistry.Reaction
if (effect.ShouldLog) if (effect.ShouldLog)
{ {
var entity = args.SolutionEntity; var entity = args.SolutionEntity;
_logSystem.Add(LogType.ReagentEffect, effect.LogImpact, _adminLogger.Add(LogType.ReagentEffect, effect.LogImpact,
$"Reaction effect {effect.GetType().Name:effect} of reaction ${reaction.ID:reaction} applied on entity {ToPrettyString(entity):entity} at {Transform(entity).Coordinates:coordinates}"); $"Reaction effect {effect.GetType().Name:effect} of reaction ${reaction.ID:reaction} applied on entity {ToPrettyString(entity):entity} at {Transform(entity).Coordinates:coordinates}");
} }

View File

@@ -15,7 +15,7 @@ namespace Content.Shared.Chemistry
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
public void ReactionEntity(EntityUid uid, ReactionMethod method, Solution solution) public void ReactionEntity(EntityUid uid, ReactionMethod method, Solution solution)
{ {
@@ -63,7 +63,7 @@ namespace Content.Shared.Chemistry
if (effect.ShouldLog) if (effect.ShouldLog)
{ {
var entity = args.SolutionEntity; var entity = args.SolutionEntity;
_logSystem.Add(LogType.ReagentEffect, effect.LogImpact, _adminLogger.Add(LogType.ReagentEffect, effect.LogImpact,
$"Reactive effect {effect.GetType().Name:effect} of reagent {reagent.ID:reagent} with method {method} applied on entity {ToPrettyString(entity):entity} at {Transform(entity).Coordinates:coordinates}"); $"Reactive effect {effect.GetType().Name:effect} of reagent {reagent.ID:reagent} with method {method} applied on entity {ToPrettyString(entity):entity} at {Transform(entity).Coordinates:coordinates}");
} }
@@ -91,7 +91,7 @@ namespace Content.Shared.Chemistry
if (effect.ShouldLog) if (effect.ShouldLog)
{ {
var entity = args.SolutionEntity; var entity = args.SolutionEntity;
_logSystem.Add(LogType.ReagentEffect, effect.LogImpact, _adminLogger.Add(LogType.ReagentEffect, effect.LogImpact,
$"Reactive effect {effect.GetType().Name:effect} of {ToPrettyString(entity):entity} using reagent {reagent.ID:reagent} with method {method} at {Transform(entity).Coordinates:coordinates}"); $"Reactive effect {effect.GetType().Name:effect} of {ToPrettyString(entity):entity} using reagent {reagent.ID:reagent} with method {method} at {Transform(entity).Coordinates:coordinates}");
} }

View File

@@ -137,7 +137,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
return; return;
} }
_adminLogSystem.Add(LogType.Pickup, LogImpact.Low, $"{ToPrettyString(uid):user} picked up {ToPrettyString(entity):entity}"); _adminLogger.Add(LogType.Pickup, LogImpact.Low, $"{ToPrettyString(uid):user} picked up {ToPrettyString(entity):entity}");
Dirty(hands); Dirty(hands);

View File

@@ -11,7 +11,7 @@ namespace Content.Shared.Hands.EntitySystems;
public abstract partial class SharedHandsSystem : EntitySystem public abstract partial class SharedHandsSystem : EntitySystem
{ {
[Dependency] private readonly SharedAdminLogSystem _adminLogSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!;

View File

@@ -42,7 +42,7 @@ namespace Content.Shared.Interaction
[Dependency] private readonly SharedPhysicsSystem _sharedBroadphaseSystem = default!; [Dependency] private readonly SharedPhysicsSystem _sharedBroadphaseSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly SharedVerbSystem _verbSystem = default!; [Dependency] private readonly SharedVerbSystem _verbSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _adminLogSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly RotateToFaceSystem _rotateToFaceSystem = default!; [Dependency] private readonly RotateToFaceSystem _rotateToFaceSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly UseDelaySystem _useDelay = default!; [Dependency] private readonly UseDelaySystem _useDelay = default!;
@@ -281,7 +281,7 @@ namespace Content.Shared.Interaction
// all interactions should only happen when in range / unobstructed, so no range check is needed // all interactions should only happen when in range / unobstructed, so no range check is needed
var message = new InteractHandEvent(user, target); var message = new InteractHandEvent(user, target);
RaiseLocalEvent(target, message); RaiseLocalEvent(target, message);
_adminLogSystem.Add(LogType.InteractHand, LogImpact.Low, $"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target}"); _adminLogger.Add(LogType.InteractHand, LogImpact.Low, $"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target}");
if (message.Handled) if (message.Handled)
return; return;
@@ -721,7 +721,7 @@ namespace Content.Shared.Interaction
if (activateMsg.Handled) if (activateMsg.Handled)
{ {
_useDelay.BeginDelay(used, delayComponent); _useDelay.BeginDelay(used, delayComponent);
_adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}"); _adminLogger.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}");
return true; return true;
} }
@@ -733,7 +733,7 @@ namespace Content.Shared.Interaction
// No way to check success. // No way to check success.
_useDelay.BeginDelay(used, delayComponent); _useDelay.BeginDelay(used, delayComponent);
_adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}"); _adminLogger.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}");
return true; return true;
} }
#endregion #endregion
@@ -808,11 +808,11 @@ namespace Content.Shared.Interaction
RaiseLocalEvent(thrown, throwMsg); RaiseLocalEvent(thrown, throwMsg);
if (throwMsg.Handled) if (throwMsg.Handled)
{ {
_adminLogSystem.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}"); _adminLogger.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}");
return; return;
} }
_adminLogSystem.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}"); _adminLogger.Add(LogType.Throw, LogImpact.Low,$"{ToPrettyString(user):user} threw {ToPrettyString(thrown):entity}");
} }
#endregion #endregion
@@ -821,7 +821,7 @@ namespace Content.Shared.Interaction
var dropMsg = new DroppedEvent(user); var dropMsg = new DroppedEvent(user);
RaiseLocalEvent(item, dropMsg); RaiseLocalEvent(item, dropMsg);
if (dropMsg.Handled) if (dropMsg.Handled)
_adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}"); _adminLogger.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}");
Transform(item).LocalRotation = Angle.Zero; Transform(item).LocalRotation = Angle.Zero;
} }
#endregion #endregion

View File

@@ -12,7 +12,7 @@ namespace Content.Shared.Slippery
[UsedImplicitly] [UsedImplicitly]
public abstract class SharedSlipperySystem : EntitySystem public abstract class SharedSlipperySystem : EntitySystem
{ {
[Dependency] private readonly SharedAdminLogSystem _adminLog = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedStunSystem _stunSystem = default!; [Dependency] private readonly SharedStunSystem _stunSystem = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!; [Dependency] private readonly StatusEffectsSystem _statusEffectsSystem = default!;
[Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedContainerSystem _container = default!;
@@ -71,7 +71,7 @@ namespace Content.Shared.Slippery
if (playSound) if (playSound)
PlaySound(component); PlaySound(component);
_adminLog.Add(LogType.Slip, LogImpact.Low, _adminLogger.Add(LogType.Slip, LogImpact.Low,
$"{ToPrettyString(other):mob} slipped on collision with {ToPrettyString(component.Owner):entity}"); $"{ToPrettyString(other):mob} slipped on collision with {ToPrettyString(component.Owner):entity}");
} }

View File

@@ -17,7 +17,7 @@ namespace Content.Shared.Throwing
public sealed class ThrownItemSystem : EntitySystem public sealed class ThrownItemSystem : EntitySystem
{ {
[Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _adminLogSystem = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly FixtureSystem _fixtures = default!; [Dependency] private readonly FixtureSystem _fixtures = default!;
private const string ThrowingFixture = "throw-fixture"; private const string ThrowingFixture = "throw-fixture";
@@ -131,7 +131,7 @@ namespace Content.Shared.Throwing
// Assume it's uninteresting if it has no thrower. For now anyway. // Assume it's uninteresting if it has no thrower. For now anyway.
if (thrownItem.Thrower is not null) if (thrownItem.Thrower is not null)
_adminLogSystem.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(landing):entity} thrown by {ToPrettyString(thrownItem.Thrower.Value):thrower} landed."); _adminLogger.Add(LogType.Landed, LogImpact.Low, $"{ToPrettyString(landing):entity} thrown by {ToPrettyString(thrownItem.Thrower.Value):thrower} landed.");
var landMsg = new LandEvent {User = thrownItem.Thrower}; var landMsg = new LandEvent {User = thrownItem.Thrower};
RaiseLocalEvent(landing, landMsg, false); RaiseLocalEvent(landing, landMsg, false);
@@ -143,7 +143,7 @@ namespace Content.Shared.Throwing
public void ThrowCollideInteraction(EntityUid? user, IPhysBody thrown, IPhysBody target) public void ThrowCollideInteraction(EntityUid? user, IPhysBody thrown, IPhysBody target)
{ {
if (user is not null) if (user is not null)
_adminLogSystem.Add(LogType.ThrowHit, LogImpact.Low, _adminLogger.Add(LogType.ThrowHit, LogImpact.Low,
$"{ToPrettyString(thrown.Owner):thrown} thrown by {ToPrettyString(user.Value):thrower} hit {ToPrettyString(target.Owner):target}."); $"{ToPrettyString(thrown.Owner):thrown} thrown by {ToPrettyString(user.Value):thrower} hit {ToPrettyString(target.Owner):target}.");
// TODO: Just pass in the bodies directly // TODO: Just pass in the bodies directly
RaiseLocalEvent(target.Owner, new ThrowHitByEvent(user, thrown.Owner, target.Owner)); RaiseLocalEvent(target.Owner, new ThrowHitByEvent(user, thrown.Owner, target.Owner));