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