Add admin logs for thermomachines (#24056)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user