Add machine frame completion feedback (#18048)
Signed-off-by: c4llv07e <kseandi@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Shared.Examine;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Stacks;
|
using Content.Shared.Stacks;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
|
using Content.Shared.Popups;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
|
||||||
namespace Content.Server.Construction;
|
namespace Content.Server.Construction;
|
||||||
@@ -16,6 +17,7 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
[Dependency] private readonly TagSystem _tag = default!;
|
[Dependency] private readonly TagSystem _tag = default!;
|
||||||
[Dependency] private readonly StackSystem _stack = default!;
|
[Dependency] private readonly StackSystem _stack = default!;
|
||||||
[Dependency] private readonly ConstructionSystem _construction = default!;
|
[Dependency] private readonly ConstructionSystem _construction = default!;
|
||||||
|
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -75,11 +77,10 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
component.Progress[machinePart.PartType]++;
|
component.Progress[machinePart.PartType]++;
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TryComp<StackComponent?>(args.Used, out var stack))
|
if (!args.Handled && TryComp<StackComponent?>(args.Used, out var stack))
|
||||||
{
|
{
|
||||||
var type = stack.StackTypeId;
|
var type = stack.StackTypeId;
|
||||||
if (type == null)
|
if (type == null)
|
||||||
@@ -114,6 +115,13 @@ public sealed class MachineFrameSystem : EntitySystem
|
|||||||
|
|
||||||
component.MaterialProgress[type] += needed;
|
component.MaterialProgress[type] += needed;
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Handled)
|
||||||
|
{
|
||||||
|
if (IsComplete(component)) {
|
||||||
|
_popupSystem.PopupEntity(Loc.GetString("machine-frame-component-on-complete"), uid);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
machine-frame-component-on-examine-label = [color=white]Current machine board:[/color] [color=cyan]{$board}[/color]
|
machine-frame-component-on-examine-label = [color=white]Current machine board:[/color] [color=cyan]{$board}[/color]
|
||||||
|
machine-frame-component-on-complete = Construction completed
|
||||||
|
|||||||
Reference in New Issue
Block a user