diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml.cs b/Content.Client/Lathe/UI/LatheMenu.xaml.cs
index 1e71d1ae89..66d875b0f2 100644
--- a/Content.Client/Lathe/UI/LatheMenu.xaml.cs
+++ b/Content.Client/Lathe/UI/LatheMenu.xaml.cs
@@ -223,13 +223,14 @@ public sealed partial class LatheMenu : DefaultWindow
/// Populates the build queue list with all queued items
///
///
- public void PopulateQueueList(List queue)
+ public void PopulateQueueList(IReadOnlyCollection> queue)
{
QueueList.DisposeAllChildren();
var idx = 1;
- foreach (var recipe in queue)
+ foreach (var recipeProto in queue)
{
+ var recipe = _prototypeManager.Index(recipeProto);
var queuedRecipeBox = new BoxContainer();
queuedRecipeBox.Orientation = BoxContainer.LayoutOrientation.Horizontal;
@@ -243,12 +244,14 @@ public sealed partial class LatheMenu : DefaultWindow
}
}
- public void SetQueueInfo(LatheRecipePrototype? recipe)
+ public void SetQueueInfo(ProtoId? recipeProto)
{
- FabricatingContainer.Visible = recipe != null;
- if (recipe == null)
+ FabricatingContainer.Visible = recipeProto != null;
+ if (recipeProto == null)
return;
+ var recipe = _prototypeManager.Index(recipeProto.Value);
+
FabricatingDisplayContainer.Children.Clear();
FabricatingDisplayContainer.AddChild(GetRecipeDisplayControl(recipe));
diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs
index 3c5ecde1c6..6ecd5bdf62 100644
--- a/Content.Server/Lathe/LatheSystem.cs
+++ b/Content.Server/Lathe/LatheSystem.cs
@@ -183,7 +183,7 @@ namespace Content.Server.Lathe
_materialStorage.TryChangeMaterialAmount(uid, mat, adjustedAmount);
}
- component.Queue.Add(recipe);
+ component.Queue.Enqueue(recipe);
return true;
}
@@ -195,8 +195,8 @@ namespace Content.Server.Lathe
if (component.CurrentRecipe != null || component.Queue.Count <= 0 || !this.IsPowered(uid, EntityManager))
return false;
- var recipe = component.Queue.First();
- component.Queue.RemoveAt(0);
+ var recipeProto = component.Queue.Dequeue();
+ var recipe = _proto.Index(recipeProto);
var time = _reagentSpeed.ApplySpeed(uid, recipe.CompleteTime) * component.TimeMultiplier;
@@ -226,13 +226,14 @@ namespace Content.Server.Lathe
if (comp.CurrentRecipe != null)
{
- if (comp.CurrentRecipe.Result is { } resultProto)
+ var currentRecipe = _proto.Index(comp.CurrentRecipe.Value);
+ if (currentRecipe.Result is { } resultProto)
{
var result = Spawn(resultProto, Transform(uid).Coordinates);
_stack.TryMergeToContacts(result);
}
- if (comp.CurrentRecipe.ResultReagents is { } resultReagents &&
+ if (currentRecipe.ResultReagents is { } resultReagents &&
comp.ReagentOutputSlotId is { } slotId)
{
var toAdd = new Solution(
@@ -269,9 +270,11 @@ namespace Content.Server.Lathe
if (!Resolve(uid, ref component))
return;
- var producing = component.CurrentRecipe ?? component.Queue.FirstOrDefault();
+ var producing = component.CurrentRecipe;
+ if (producing == null && component.Queue.TryPeek(out var next))
+ producing = next;
- var state = new LatheUpdateState(GetAvailableRecipes(uid, component), component.Queue, producing);
+ var state = new LatheUpdateState(GetAvailableRecipes(uid, component), component.Queue.ToArray(), producing);
_uiSys.SetUiState(uid, LatheUiKey.Key, state);
}
diff --git a/Content.Shared/Lathe/LatheComponent.cs b/Content.Shared/Lathe/LatheComponent.cs
index 80f4f62a31..8b701ff64e 100644
--- a/Content.Shared/Lathe/LatheComponent.cs
+++ b/Content.Shared/Lathe/LatheComponent.cs
@@ -29,7 +29,7 @@ namespace Content.Shared.Lathe
/// The lathe's construction queue
///
[DataField]
- public List Queue = new();
+ public Queue> Queue = new();
///
/// The sound that plays when the lathe is producing an item, if any
@@ -64,7 +64,7 @@ namespace Content.Shared.Lathe
/// The recipe the lathe is currently producing
///
[ViewVariables]
- public LatheRecipePrototype? CurrentRecipe;
+ public ProtoId? CurrentRecipe;
#region MachineUpgrading
///
diff --git a/Content.Shared/Lathe/LatheMessages.cs b/Content.Shared/Lathe/LatheMessages.cs
index 820c496d30..1c1c6440f1 100644
--- a/Content.Shared/Lathe/LatheMessages.cs
+++ b/Content.Shared/Lathe/LatheMessages.cs
@@ -1,4 +1,5 @@
using Content.Shared.Research.Prototypes;
+using NetSerializer;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
@@ -9,11 +10,11 @@ public sealed class LatheUpdateState : BoundUserInterfaceState
{
public List> Recipes;
- public List Queue;
+ public ProtoId[] Queue;
- public LatheRecipePrototype? CurrentlyProducing;
+ public ProtoId? CurrentlyProducing;
- public LatheUpdateState(List> recipes, List queue, LatheRecipePrototype? currentlyProducing = null)
+ public LatheUpdateState(List> recipes, ProtoId[] queue, ProtoId? currentlyProducing = null)
{
Recipes = recipes;
Queue = queue;
diff --git a/Content.Shared/Research/Prototypes/LatheRecipePrototype.cs b/Content.Shared/Research/Prototypes/LatheRecipePrototype.cs
index 7d26971b11..957526d802 100644
--- a/Content.Shared/Research/Prototypes/LatheRecipePrototype.cs
+++ b/Content.Shared/Research/Prototypes/LatheRecipePrototype.cs
@@ -3,13 +3,12 @@ using Content.Shared.FixedPoint;
using Content.Shared.Lathe.Prototypes;
using Content.Shared.Materials;
using Robust.Shared.Prototypes;
-using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
using Robust.Shared.Utility;
namespace Content.Shared.Research.Prototypes
{
- [NetSerializable, Serializable, Prototype]
+ [Prototype]
public sealed partial class LatheRecipePrototype : IPrototype, IInheritingPrototype
{
[ViewVariables]