adds which machine board currently inserted/building to machine frames, issue #10891 (#10945)

Co-authored-by: CommieFlowers <rasmus.cedergren@hotmail.com>
This commit is contained in:
rolfero
2022-08-31 10:59:02 +02:00
committed by GitHub
parent c964443714
commit ccb240ccca
2 changed files with 11 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
using Content.Server.Construction.Components;
using Content.Server.Construction.Components;
using Content.Server.Stack;
using Content.Shared.Construction;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Tag;
using Robust.Shared.Containers;
@@ -22,6 +23,7 @@ public sealed class MachineFrameSystem : EntitySystem
SubscribeLocalEvent<MachineFrameComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<MachineFrameComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<MachineFrameComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<MachineFrameComponent, ExaminedEvent>(OnMachineFrameExamined);
}
private void OnInit(EntityUid uid, MachineFrameComponent component, ComponentInit args)
@@ -295,4 +297,11 @@ public sealed class MachineFrameSystem : EntitySystem
}
}
}
private void OnMachineFrameExamined(EntityUid uid, MachineFrameComponent component, ExaminedEvent args)
{
if (!args.IsInDetailsRange)
return;
if (component.HasBoard)
args.PushMarkup(Loc.GetString("machine-frame-component-on-examine-label", ("board", EntityManager.GetComponent<MetaDataComponent>(component.BoardContainer.ContainedEntities[0]).EntityName)));
}
}