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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user