diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index 3df6c82bee..57229fa447 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -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(OnLatheQueueRecipeMessage); SubscribeLocalEvent(OnLatheSyncRequestMessage); SubscribeLocalEvent(OnLatheServerSelectionMessage); + SubscribeLocalEvent(OnPowerChanged); SubscribeLocalEvent(OnLatheServerSyncMessage); } @@ -156,7 +158,7 @@ namespace Content.Server.Lathe EntityManager.QueueDeleteEntity(args.Used); EnsureComp(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); + } + /// /// This handles the checks to start producing an item, and /// starts up the sound and visuals