fix lathe queue interruption bug (#10533)

This commit is contained in:
Nemanja
2022-08-11 21:33:32 -04:00
committed by GitHub
parent 8274e10107
commit 5670769435

View File

@@ -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
@@ -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);
}
@@ -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