Add admin logs for thermomachines (#24056)

This commit is contained in:
Trevor Day
2024-01-13 20:05:45 -08:00
committed by GitHub
parent ee5b954448
commit 7a84f9e203
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

@@ -94,4 +94,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,
}