Particle Accelerator power changed admin chat warning (#18806)

This commit is contained in:
ShadowCommander
2023-08-07 10:07:57 -07:00
committed by GitHub
parent bd172aa72e
commit c4fb166af3
4 changed files with 22 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ using Robust.Server.Player;
using Robust.Server.GameObjects;
using Robust.Shared.Utility;
using System.Diagnostics;
using Content.Shared.CCVar;
namespace Content.Server.ParticleAccelerator.EntitySystems;
@@ -159,6 +160,17 @@ public sealed partial class ParticleAcceleratorSystem
};
_adminLogger.Add(LogType.Action, impact, $"{ToPrettyString(player):player} has set the strength of {ToPrettyString(uid)} to {strength}");
var alertMinPowerState = (ParticleAcceleratorPowerState)_cfg.GetCVar(CCVars.AdminAlertParticleAcceleratorMinPowerState);
if (strength >= alertMinPowerState)
{
var pos = Transform(uid);
_chat.SendAdminAlert(player, Loc.GetString("particle-accelerator-admin-power-strength-warning",
("machine", ToPrettyString(uid)),
("powerState", strength),
("coordinates", pos.Coordinates)));
}
}
comp.SelectedStrength = strength;

View File

@@ -1,9 +1,11 @@
using Content.Server.Administration.Logs;
using Content.Server.Chat.Managers;
using Content.Server.Projectiles;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Map;
using Robust.Shared.Timing;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
namespace Content.Server.ParticleAccelerator.EntitySystems;
@@ -12,6 +14,8 @@ public sealed partial class ParticleAcceleratorSystem : EntitySystem
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly ProjectileSystem _projectileSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;