]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add admin logs for thermomachines (#24056)
authorTrevor Day <tday93@users.noreply.github.com>
Sun, 14 Jan 2024 04:05:45 +0000 (20:05 -0800)
committerGitHub <noreply@github.com>
Sun, 14 Jan 2024 04:05:45 +0000 (20:05 -0800)
Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs
Content.Shared.Database/LogType.cs

index eec610ffa6140f72262142d39306b2e63815ae29..8e065921fed6f29ebd1f68964af1d985ad197a04 100644 (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);
         }
 
index 1d5dbcc3b4828436349817cf82ab16efdaca6192..b3cdc6020989511a874270863e4fcbba06ebf367 100644 (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,
 }