Adds even more important Admin Logging (#10268)

This commit is contained in:
Júlio César Ueti
2022-08-07 20:21:56 -03:00
committed by GitHub
parent a2d8e96a53
commit ee969c9799
15 changed files with 147 additions and 49 deletions

View File

@@ -1,9 +1,11 @@
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Dispenser;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
@@ -29,6 +31,7 @@ namespace Content.Server.Chemistry.Components
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[ViewVariables] [DataField("pack", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentDispenserInventoryPrototype>))] private string _packPrototypeId = "";
@@ -171,8 +174,11 @@ namespace Content.Server.Chemistry.Components
if (BeakerSlot.HasItem)
{
TryDispense(msg.DispenseIndex);
// Ew
if (BeakerSlot.Item != null)
_adminLogger.Add(LogType.ChemicalReaction, LogImpact.Medium,
$"{_entities.ToPrettyString(obj.Session.AttachedEntity.Value):player} dispensed {_dispenseAmount}u of {Inventory[msg.DispenseIndex].ID} into {_entities.ToPrettyString(BeakerSlot.Item.Value):entity}");
}
Logger.Info($"User {obj.Session.UserId.UserId} ({obj.Session.Name}) dispensed {_dispenseAmount}u of {Inventory[msg.DispenseIndex].ID}");
break;
default:

View File

@@ -1,9 +1,11 @@
using Content.Server.Administration.Logs;
using Content.Shared.Verbs;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Content.Shared.Chemistry.Components;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Popups;
@@ -14,6 +16,7 @@ namespace Content.Server.Chemistry.EntitySystems
public sealed class SolutionTransferSystem : EntitySystem
{
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
/// <summary>
/// Default transfer amounts for the set-transfer verb.
@@ -181,6 +184,9 @@ namespace Content.Server.Chemistry.EntitySystems
var solution = solutionSystem.Drain(sourceEntity, source, actualAmount);
solutionSystem.Refill(targetEntity, target, solution);
_adminLogger.Add(LogType.Action, LogImpact.Medium,
$"{EntityManager.ToPrettyString(user):player} transferred {string.Join(", ", solution.Contents)} to {EntityManager.ToPrettyString(targetEntity):entity}, which now contains {string.Join(", ", target.Contents)}");
return actualAmount;
}
}