Add machine logs (#13185)

* add material insert logs

* add lathe queue logs

* add grav gen power logs

* fix count

* replace SharedStackComponent with StackComponent and rm unused imports

* use TryComp

* fix import
This commit is contained in:
Chief-Engineer
2022-12-27 11:01:36 -06:00
committed by GitHub
parent 1db51e93b1
commit 2a8e5d9096
3 changed files with 32 additions and 5 deletions

View File

@@ -1,7 +1,9 @@
using Content.Shared.Materials;
using Content.Server.Administration.Logs;
using Content.Shared.Materials;
using Content.Shared.Popups;
using Content.Server.Power.Components;
using Robust.Shared.Player;
using Content.Shared.Database;
using Content.Shared.Stacks;
namespace Content.Server.Materials;
@@ -10,6 +12,7 @@ namespace Content.Server.Materials;
/// </summary>
public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
{
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
@@ -25,6 +28,13 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
_popup.PopupEntity(Loc.GetString("machine-insert-item", ("user", user), ("machine", component.Owner),
("item", toInsert)), component.Owner);
QueueDel(toInsert);
// Logging
TryComp<StackComponent>(toInsert, out var stack);
var count = stack?.Count ?? 1;
_adminLogger.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(user):player} inserted {count} {ToPrettyString(toInsert):inserted} into {ToPrettyString(receiver):receiver}");
return true;
}
}