Skip to content

Commit

Permalink
Add admin logs for thermomachines (#24056)
Browse files Browse the repository at this point in the history
  • Loading branch information
tday93 authored Jan 14, 2024
1 parent ee5b954 commit 7a84f9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
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
Expand All @@ -27,6 +29,7 @@ public sealed class GasThermoMachineSystem : EntitySystem
[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()
{
Expand Down Expand Up @@ -110,7 +113,8 @@ private bool IsHeater(GasThermoMachineComponent comp)

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);
}

Expand All @@ -121,6 +125,7 @@ private void OnChangeTemperature(EntityUid uid, GasThermoMachineComponent thermo
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);
}

Expand Down
1 change: 1 addition & 0 deletions Content.Shared.Database/LogType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

0 comments on commit 7a84f9e

Please sign in to comment.