Add admin logs for thermomachines (#24056)

(cherry picked from commit 7a84f9e2038d4f0d9c776a4e1a91b83a4997a43e)
This commit is contained in:
Trevor Day 2024-01-13 20:05:45 -08:00 committed by Debug
parent beefa6c6e9
commit 90c75efd9a
No known key found for this signature in database
GPG Key ID: 271270A74EF9C350
2 changed files with 7 additions and 1 deletions

View File

@ -15,6 +15,8 @@ using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Content.Server.Power.EntitySystems;
using Content.Server.UserInterface;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Examine;
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
@ -27,6 +29,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
[Dependency] private readonly PowerReceiverSystem _power = default!;
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
[Dependency] private readonly DeviceNetworkSystem _deviceNetwork = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
public override void Initialize()
{
@ -110,7 +113,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnToggleMessage(EntityUid uid, GasThermoMachineComponent thermoMachine, GasThermomachineToggleMessage args)
{
_power.TogglePower(uid);
var powerState = _power.TogglePower(uid);
_adminLogger.Add(LogType.AtmosPowerChanged, $"{ToPrettyString(args.Session.AttachedEntity)} turned {(powerState ? "On" : "Off")} {ToPrettyString(uid)}");
DirtyUI(uid, thermoMachine);
}
@ -121,6 +125,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
else
thermoMachine.TargetTemperature = MathF.Max(args.Temperature, thermoMachine.MinTemperature);
thermoMachine.TargetTemperature = MathF.Max(thermoMachine.TargetTemperature, Atmospherics.TCMB);
_adminLogger.Add(LogType.AtmosTemperatureChanged, $"{ToPrettyString(args.Session.AttachedEntity)} set temperature on {ToPrettyString(uid)} to {thermoMachine.TargetTemperature}");
DirtyUI(uid, thermoMachine);
}

View File

@ -96,4 +96,5 @@ public enum LogType
/// A client has sent too many chat messages recently and is temporarily blocked from sending more.
/// </summary>
ChatRateLimited = 87,
AtmosTemperatureChanged = 88,
}