[tweak] critical logs in admin chat

# Conflicts:
#	Content.Server/AME/AMENodeGroup.cs
#	Content.Server/AME/Components/AMEControllerComponent.cs
#	Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs
#	Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs
#	Content.Server/Gravity/GravityGeneratorSystem.cs
#	Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs
#	Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs
#	Content.Server/Singularity/EntitySystems/SingularityGeneratorSystem.cs
This commit is contained in:
rhailrake
2023-04-27 20:49:41 +06:00
committed by Remuchi
parent ea4f7595a2
commit 509a5d6862
7 changed files with 77 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Binary.Components;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Chat.Managers;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
@@ -29,6 +30,8 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly EntityManager _entityManager = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
public override void Initialize()
{
@@ -124,8 +127,12 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
private void OnToggleStatusMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpToggleStatusMessage args)
{
pump.Enabled = args.Enabled;
var player = args.Session.AttachedEntity!.Value;
_adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
$"{ToPrettyString(player):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
if (_entityManager.GetComponent<MetaDataComponent>(uid).EntityName == "plasma pump" && args.Enabled)
_chatManager.SendAdminAnnouncement(Loc.GetString("admin-chatalert-plasma-pump-enabled",
("pump", ToPrettyString(uid)), ("player", ToPrettyString(player))));
DirtyUI(uid, pump);
UpdateAppearance(uid, pump);
}
@@ -133,8 +140,12 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
private void OnOutputPressureChangeMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpChangeOutputPressureMessage args)
{
pump.TargetPressure = Math.Clamp(args.Pressure, 0f, Atmospherics.MaxOutputPressure);
var player = args.Session.AttachedEntity!.Value;
_adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium,
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa");
$"{ToPrettyString(player):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa");
if (_entityManager.GetComponent<MetaDataComponent>(uid).EntityName == "plasma pump")
_chatManager.SendAdminAnnouncement(Loc.GetString("admin-chatalert-plasma-pump-pressure-change",
("pump", ToPrettyString(uid)), ("player", ToPrettyString(player)), ("pressure", args.Pressure)));
DirtyUI(uid, pump);
}

View File

@@ -4,6 +4,7 @@ using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.Cargo.Systems;
using Content.Server.Chat.Managers;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
@@ -36,6 +37,9 @@ public sealed class GasCanisterSystem : EntitySystem
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
[Dependency] private readonly ItemSlotsSystem _slots = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
private readonly int _plasmaThreshold = 1000;
public override void Initialize()
{
@@ -134,19 +138,24 @@ public sealed class GasCanisterSystem : EntitySystem
private void OnCanisterChangeReleaseValve(EntityUid uid, GasCanisterComponent canister, GasCanisterChangeReleaseValveMessage args)
{
var impact = LogImpact.High;
// filling a jetpack with plasma is less important than filling a room with it
impact = canister.GasTankSlot.HasItem ? LogImpact.Medium : LogImpact.High;
var impact = canister.GasTankSlot.HasItem ? LogImpact.Medium : LogImpact.High;
var containedGasDict = new Dictionary<Gas, float>();
var containedGasArray = Gas.GetValues(typeof(Gas));
for (int i = 0; i < containedGasArray.Length; i++)
for (var i = 0; i < containedGasArray.Length; i++)
{
containedGasDict.Add((Gas)i, canister.Air.Moles[i]);
}
_adminLogger.Add(LogType.CanisterValve, impact, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the valve on {ToPrettyString(uid):canister} to {args.Valve:valveState} while it contained [{string.Join(", ", containedGasDict)}]");
var player = args.Session.AttachedEntity.GetValueOrDefault();
_adminLogger.Add(LogType.CanisterValve, impact, $"{ToPrettyString(player):player} set the valve on {ToPrettyString(uid):canister} to {args.Valve:valveState} while it contained [{string.Join(", ", containedGasDict)}]");
if (args.Valve && containedGasDict[Gas.Plasma] >= _plasmaThreshold)
{
_chatManager.SendAdminAnnouncement(Loc.GetString("admin-chatalert-plasma-canister-opened",
("player", ToPrettyString(player)), ("canister", ToPrettyString(uid))));
}
canister.ReleaseValve = args.Valve;
DirtyUI(uid, canister);