fix lathe queue interruption bug (#10533)
This commit is contained in:
@@ -15,6 +15,7 @@ using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Player;
|
||||
using JetBrains.Annotations;
|
||||
using System.Linq;
|
||||
using Content.Server.Power.Components;
|
||||
using Robust.Server.Player;
|
||||
|
||||
namespace Content.Server.Lathe
|
||||
@@ -27,7 +28,7 @@ namespace Content.Server.Lathe
|
||||
[Dependency] private readonly SharedAudioSystem _audioSys = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSys = default!;
|
||||
[Dependency] private readonly ResearchSystem _researchSys = default!;
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -36,6 +37,7 @@ namespace Content.Server.Lathe
|
||||
SubscribeLocalEvent<LatheComponent, LatheQueueRecipeMessage>(OnLatheQueueRecipeMessage);
|
||||
SubscribeLocalEvent<LatheComponent, LatheSyncRequestMessage>(OnLatheSyncRequestMessage);
|
||||
SubscribeLocalEvent<LatheComponent, LatheServerSelectionMessage>(OnLatheServerSelectionMessage);
|
||||
SubscribeLocalEvent<LatheComponent, PowerChangedEvent>(OnPowerChanged);
|
||||
SubscribeLocalEvent<TechnologyDatabaseComponent, LatheServerSyncMessage>(OnLatheServerSyncMessage);
|
||||
}
|
||||
|
||||
@@ -156,7 +158,7 @@ namespace Content.Server.Lathe
|
||||
EntityManager.QueueDeleteEntity(args.Used);
|
||||
|
||||
EnsureComp<LatheInsertingComponent>(uid).TimeRemaining = component.InsertionTime;
|
||||
|
||||
|
||||
_popupSystem.PopupEntity(Loc.GetString("machine-insert-item", ("machine", uid),
|
||||
("item", args.Used)), uid, Filter.Entities(args.User));
|
||||
|
||||
@@ -167,6 +169,14 @@ namespace Content.Server.Lathe
|
||||
UpdateInsertingAppearance(uid, true);
|
||||
}
|
||||
|
||||
|
||||
private void OnPowerChanged(EntityUid uid, LatheComponent component, PowerChangedEvent args)
|
||||
{
|
||||
//if the power state changes, try to produce.
|
||||
//aka, if you went from unpowered --> powered, resume lathe queue.
|
||||
TryStartProducing(uid, component: component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This handles the checks to start producing an item, and
|
||||
/// starts up the sound and visuals
|
||||
|
||||
Reference in New Issue
Block a user