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,11 +1,13 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Construction;
using Content.Server.Lathe.Components;
using Content.Server.Materials;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.UserInterface;
using Content.Shared.Database;
using Content.Shared.Lathe;
using Content.Shared.Materials;
using Content.Shared.Research.Components;
@@ -22,6 +24,7 @@ namespace Content.Server.Lathe
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly UserInterfaceSystem _uiSys = default!;
@@ -287,10 +290,15 @@ namespace Content.Server.Lathe
{
if (_proto.TryIndex(args.ID, out LatheRecipePrototype? recipe))
{
var count = 0;
for (var i = 0; i < args.Quantity; i++)
{
TryAddToQueue(uid, recipe, component);
if (TryAddToQueue(uid, recipe, component))
count++;
}
if (count > 0 && args.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(args.Session.AttachedEntity.Value):player} queued {count} {recipe.Name} at {ToPrettyString(uid):lathe}");
}
TryStartProducing(uid, component);
UpdateUserInterfaceState(uid, component);