Partial lathe ECS, fix cursed lathe visualizer, a bit more audiovisual feedback for lathes (#7238)
* Prototype that's mostly borked rather than completely borked * ECS inserting mats * Partial ECS mostly done, needs cleanup and visualizer * Replace timers * Power visualizes at least * First ""working"" version * Clean up all lathes * Colors * Fix animation timing * Fixes greyscale, adds a bunch of colors * Give every (used) material a color * Made most lathes take long enough you can at least see there's some sort of animation * Insertion feedback popup * Sound for circuit printer and uniform printer * Fix queueing, optimize update * Remove mono crash * cleanup * Fix test failure * Techfab inserting sprite * Cleanup and commenting * Fix bug in CanProduce check * Fix UI resolves * Mirror review stuff
This commit is contained in:
@@ -1,219 +1,53 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Materials;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Research.Components;
|
||||
using Content.Server.Stack;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Power;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Content.Shared.Sound;
|
||||
|
||||
namespace Content.Server.Lathe.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class LatheComponent : SharedLatheComponent, IInteractUsing
|
||||
public sealed class LatheComponent : SharedLatheComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public const int VolumePerSheet = 100;
|
||||
/// <summary>
|
||||
/// How much volume in cm^3 each sheet of material adds
|
||||
/// </summary>
|
||||
public int VolumePerSheet = 100;
|
||||
|
||||
/// <summary>
|
||||
/// The lathe's construction queue
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public Queue<LatheRecipePrototype> Queue { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// The recipe the lathe is currently producing
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public bool Producing { get; private set; }
|
||||
|
||||
private LatheState _state = LatheState.Base;
|
||||
|
||||
private LatheState State
|
||||
{
|
||||
get => _state;
|
||||
set => _state = value;
|
||||
}
|
||||
|
||||
public LatheRecipePrototype? ProducingRecipe;
|
||||
/// <summary>
|
||||
/// How long the inserting animation will play
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private LatheRecipePrototype? _producingRecipe;
|
||||
public float InsertionTime = 0.79f; // 0.01 off for animation timing
|
||||
/// <summary>
|
||||
/// Update accumulator for the insertion time
|
||||
/// </suummary>
|
||||
public float InsertionAccumulator = 0f;
|
||||
/// <summary>
|
||||
/// Production accumulator for the production time.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private bool Powered => !_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
public float ProducingAccumulator = 0f;
|
||||
|
||||
private static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f);
|
||||
/// <summary>
|
||||
/// The sound that plays when the lathe is producing an item, if any
|
||||
/// </summary>
|
||||
[DataField("producingSound")]
|
||||
public SoundSpecifier? ProducingSound;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(LatheUiKey.Key);
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (UserInterface != null)
|
||||
{
|
||||
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||
}
|
||||
}
|
||||
|
||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
||||
{
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
switch (message.Message)
|
||||
{
|
||||
case LatheQueueRecipeMessage msg:
|
||||
PrototypeManager.TryIndex(msg.ID, out LatheRecipePrototype? recipe);
|
||||
if (recipe != null!)
|
||||
for (var i = 0; i < msg.Quantity; i++)
|
||||
{
|
||||
Queue.Enqueue(recipe);
|
||||
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
||||
}
|
||||
break;
|
||||
case LatheSyncRequestMessage _:
|
||||
if (!_entMan.HasComponent<MaterialStorageComponent>(Owner)) return;
|
||||
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
||||
if (_producingRecipe != null)
|
||||
UserInterface?.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID));
|
||||
break;
|
||||
|
||||
case LatheServerSelectionMessage _:
|
||||
if (!_entMan.TryGetComponent(Owner, out ResearchClientComponent? researchClient)) return;
|
||||
researchClient.OpenUserInterface(message.Session);
|
||||
break;
|
||||
|
||||
case LatheServerSyncMessage _:
|
||||
if (!_entMan.TryGetComponent(Owner, out TechnologyDatabaseComponent? database)
|
||||
|| !_entMan.TryGetComponent(Owner, out ProtolatheDatabaseComponent? protoDatabase)) return;
|
||||
|
||||
if (database.SyncWithServer())
|
||||
protoDatabase.Sync();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal bool Produce(LatheRecipePrototype recipe)
|
||||
{
|
||||
if (Producing || !Powered || !CanProduce(recipe) || !_entMan.TryGetComponent(Owner, out MaterialStorageComponent? storage)) return false;
|
||||
|
||||
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
||||
|
||||
Producing = true;
|
||||
_producingRecipe = recipe;
|
||||
|
||||
foreach (var (material, amount) in recipe.RequiredMaterials)
|
||||
{
|
||||
// This should always return true, otherwise CanProduce fucked up.
|
||||
storage.RemoveMaterial(material, amount);
|
||||
}
|
||||
|
||||
UserInterface?.SendMessage(new LatheProducingRecipeMessage(recipe.ID));
|
||||
|
||||
State = LatheState.Producing;
|
||||
SetAppearance(LatheVisualState.Producing);
|
||||
|
||||
Owner.SpawnTimer(recipe.CompleteTime, () =>
|
||||
{
|
||||
Producing = false;
|
||||
_producingRecipe = null;
|
||||
_entMan.SpawnEntity(recipe.Result, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage());
|
||||
State = LatheState.Base;
|
||||
SetAppearance(LatheVisualState.Idle);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OpenUserInterface(IPlayerSession session)
|
||||
{
|
||||
UserInterface?.Open(session);
|
||||
}
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!_entMan.TryGetComponent(Owner, out MaterialStorageComponent? storage)
|
||||
|| !_entMan.TryGetComponent(eventArgs.Using, out MaterialComponent? material)) return false;
|
||||
|
||||
var multiplier = 1;
|
||||
|
||||
if (_entMan.TryGetComponent(eventArgs.Using, out StackComponent? stack)) multiplier = stack.Count;
|
||||
|
||||
var totalAmount = 0;
|
||||
|
||||
// Check if it can insert all materials.
|
||||
foreach (var mat in material.MaterialIds)
|
||||
{
|
||||
// TODO: Change how MaterialComponent works so this is not hard-coded.
|
||||
if (!storage.CanInsertMaterial(mat, VolumePerSheet * multiplier)) return false;
|
||||
totalAmount += VolumePerSheet * multiplier;
|
||||
}
|
||||
|
||||
// Check if it can take ALL of the material's volume.
|
||||
if (storage.CanTakeAmount(totalAmount)) return false;
|
||||
|
||||
foreach (var mat in material.MaterialIds)
|
||||
{
|
||||
storage.InsertMaterial(mat, VolumePerSheet * multiplier);
|
||||
}
|
||||
|
||||
State = LatheState.Inserting;
|
||||
switch (material.Materials.FirstOrDefault()?.ID)
|
||||
{
|
||||
case "Steel":
|
||||
SetAppearance(LatheVisualState.InsertingMetal);
|
||||
break;
|
||||
case "Glass":
|
||||
SetAppearance(LatheVisualState.InsertingGlass);
|
||||
break;
|
||||
case "Gold":
|
||||
SetAppearance(LatheVisualState.InsertingGold);
|
||||
break;
|
||||
case "Plastic":
|
||||
SetAppearance(LatheVisualState.InsertingPlastic);
|
||||
break;
|
||||
case "Plasma":
|
||||
SetAppearance(LatheVisualState.InsertingPlasma);
|
||||
break;
|
||||
}
|
||||
|
||||
Owner.SpawnTimer(InsertionTime, () =>
|
||||
{
|
||||
State = LatheState.Base;
|
||||
SetAppearance(LatheVisualState.Idle);
|
||||
});
|
||||
|
||||
_entMan.DeleteEntity(eventArgs.Using);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetAppearance(LatheVisualState state)
|
||||
{
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(PowerDeviceVisuals.VisualState, state);
|
||||
}
|
||||
}
|
||||
|
||||
private Queue<string> GetIdQueue()
|
||||
{
|
||||
var queue = new Queue<string>();
|
||||
foreach (var recipePrototype in Queue)
|
||||
{
|
||||
queue.Enqueue(recipePrototype.ID);
|
||||
}
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
private enum LatheState : byte
|
||||
{
|
||||
Base,
|
||||
Inserting,
|
||||
Producing
|
||||
}
|
||||
/// <summmary>
|
||||
/// The lathe's UI.
|
||||
/// </summary>
|
||||
[ViewVariables] public BoundUserInterface? UserInterface;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Content.Server.Lathe.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// For EntityQuery to keep track of which lathes are inserting
|
||||
/// <summary>
|
||||
[RegisterComponent]
|
||||
public sealed class LatheInsertingComponent : Component
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Content.Server.Lathe.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// For EntityQuery to keep track of which lathes are producing
|
||||
/// <summary>
|
||||
[RegisterComponent]
|
||||
public sealed class LatheProducingComponent : Component
|
||||
{}
|
||||
}
|
||||
@@ -1,21 +1,286 @@
|
||||
using Content.Server.Lathe.Components;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Content.Server.Research.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Server.Materials;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Stack;
|
||||
using Content.Server.UserInterface;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Lathe
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class LatheSystem : EntitySystem
|
||||
public sealed class LatheSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<LatheComponent, InteractUsingEvent>(OnInteractUsing);
|
||||
SubscribeLocalEvent<LatheComponent, ComponentInit>(OnComponentInit);
|
||||
}
|
||||
|
||||
// These queues are to add/remove COMPONENTS to the lathes
|
||||
private Queue<EntityUid> ProducingAddQueue = new();
|
||||
private Queue<EntityUid> ProducingRemoveQueue = new();
|
||||
private Queue<EntityUid> InsertingAddQueue = new();
|
||||
private Queue<EntityUid> InsertingRemoveQueue = new();
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var comp in EntityManager.EntityQuery<LatheComponent>())
|
||||
foreach (var uid in ProducingAddQueue)
|
||||
EnsureComp<LatheProducingComponent>(uid);
|
||||
ProducingAddQueue.Clear();
|
||||
foreach (var uid in ProducingRemoveQueue)
|
||||
RemComp<LatheProducingComponent>(uid);
|
||||
ProducingRemoveQueue.Clear();
|
||||
foreach (var uid in InsertingAddQueue)
|
||||
EnsureComp<LatheInsertingComponent>(uid);
|
||||
InsertingAddQueue.Clear();
|
||||
foreach (var uid in InsertingRemoveQueue)
|
||||
RemComp<LatheInsertingComponent>(uid);
|
||||
InsertingRemoveQueue.Clear();
|
||||
|
||||
foreach (var (insertingComp, lathe) in EntityQuery<LatheInsertingComponent, LatheComponent>(false))
|
||||
{
|
||||
if (comp.Producing == false && comp.Queue.Count > 0)
|
||||
if (lathe.InsertionAccumulator < lathe.InsertionTime)
|
||||
{
|
||||
comp.Produce(comp.Queue.Dequeue());
|
||||
lathe.InsertionAccumulator += frameTime;
|
||||
continue;
|
||||
}
|
||||
lathe.InsertionAccumulator = 0;
|
||||
UpdateInsertingAppearance(lathe.Owner, false);
|
||||
InsertingRemoveQueue.Enqueue(lathe.Owner);
|
||||
}
|
||||
|
||||
foreach (var (producingComp, lathe) in EntityQuery<LatheProducingComponent, LatheComponent>(false))
|
||||
{
|
||||
if (lathe.ProducingRecipe == null)
|
||||
continue;
|
||||
if (lathe.ProducingAccumulator < lathe.ProducingRecipe.CompleteTime.TotalSeconds)
|
||||
{
|
||||
lathe.ProducingAccumulator += frameTime;
|
||||
continue;
|
||||
}
|
||||
lathe.ProducingAccumulator = 0;
|
||||
|
||||
FinishProducing(lathe.ProducingRecipe, lathe);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the UI and appearance.
|
||||
/// Appearance requires initialization or the layers break
|
||||
/// </summary>
|
||||
private void OnComponentInit(EntityUid uid, LatheComponent component, ComponentInit args)
|
||||
{
|
||||
component.UserInterface = uid.GetUIOrNull(LatheUiKey.Key);
|
||||
if (component.UserInterface != null)
|
||||
{
|
||||
component.UserInterface.OnReceiveMessage += msg => UserInterfaceOnOnReceiveMessage(uid, component, msg);
|
||||
}
|
||||
|
||||
if (!TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
return;
|
||||
appearance.SetData(LatheVisuals.IsInserting, false);
|
||||
appearance.SetData(LatheVisuals.IsRunning, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When someone tries to use an item on the lathe,
|
||||
/// insert it if it's a stack and fits inside
|
||||
/// </summary>
|
||||
private void OnInteractUsing(EntityUid uid, LatheComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (!TryComp<MaterialStorageComponent>(uid, out var storage) || !TryComp<MaterialComponent>(args.Used, out var material))
|
||||
return;
|
||||
|
||||
var multiplier = 1;
|
||||
|
||||
if (TryComp<StackComponent>(args.Used, out var stack))
|
||||
multiplier = stack.Count;
|
||||
|
||||
var totalAmount = 0;
|
||||
|
||||
// Check if it can insert all materials.
|
||||
foreach (var mat in material.MaterialIds)
|
||||
{
|
||||
// TODO: Change how MaterialComponent works so this is not hard-coded.
|
||||
if (!storage.CanInsertMaterial(mat, component.VolumePerSheet * multiplier))
|
||||
return;
|
||||
totalAmount += component.VolumePerSheet * multiplier;
|
||||
}
|
||||
|
||||
// Check if it can take ALL of the material's volume.
|
||||
if (storage.StorageLimit > 0 && !storage.CanTakeAmount(totalAmount))
|
||||
return;
|
||||
var lastMat = string.Empty;
|
||||
foreach (var mat in material.MaterialIds)
|
||||
{
|
||||
storage.InsertMaterial(mat, component.VolumePerSheet * multiplier);
|
||||
lastMat = mat;
|
||||
}
|
||||
/// We need the prototype to get the color
|
||||
_prototypeManager.TryIndex(lastMat, out MaterialPrototype? matProto);
|
||||
|
||||
EntityManager.QueueDeleteEntity(args.Used);
|
||||
InsertingAddQueue.Enqueue(uid);
|
||||
_popupSystem.PopupEntity(Loc.GetString("machine-insert-item", ("machine", uid),
|
||||
("item", args.Used)), uid, Filter.Entities(args.User));
|
||||
if (matProto != null)
|
||||
{
|
||||
UpdateInsertingAppearance(uid, true, matProto.Color);
|
||||
}
|
||||
UpdateInsertingAppearance(uid, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This handles the checks to start producing an item, and
|
||||
/// starts up the sound and visuals
|
||||
/// </summary>
|
||||
private bool Produce(LatheComponent component, LatheRecipePrototype recipe, bool SkipCheck = false)
|
||||
{
|
||||
if (!component.CanProduce(recipe)
|
||||
|| !TryComp(component.Owner, out MaterialStorageComponent? storage))
|
||||
return false;
|
||||
|
||||
if (!SkipCheck && HasComp<LatheProducingComponent>(component.Owner))
|
||||
return false;
|
||||
|
||||
if (TryComp<ApcPowerReceiverComponent>(component.Owner, out var receiver) && !receiver.Powered)
|
||||
return false;
|
||||
|
||||
component.UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue(component)));
|
||||
|
||||
component.ProducingRecipe = recipe;
|
||||
|
||||
foreach (var (material, amount) in recipe.RequiredMaterials)
|
||||
{
|
||||
// This should always return true, otherwise CanProduce fucked up.
|
||||
storage.RemoveMaterial(material, amount);
|
||||
}
|
||||
|
||||
component.UserInterface?.SendMessage(new LatheProducingRecipeMessage(recipe.ID));
|
||||
if (component.ProducingSound != null)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(component.Owner), component.ProducingSound.GetSound(), component.Owner);
|
||||
}
|
||||
UpdateRunningAppearance(component.Owner, true);
|
||||
ProducingAddQueue.Enqueue(component.Owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// After the production timer is up, this spawns the recipe and
|
||||
/// either cleans up or continues to the next item in the queue
|
||||
/// </summary>
|
||||
private void FinishProducing(LatheRecipePrototype recipe, LatheComponent component)
|
||||
{
|
||||
component.ProducingRecipe = null;
|
||||
EntityManager.SpawnEntity(recipe.Result, Comp<TransformComponent>(component.Owner).Coordinates);
|
||||
component.UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage());
|
||||
// Continue to next in queue if there are items left
|
||||
if (component.Queue.Count > 0)
|
||||
{
|
||||
Produce(component, component.Queue.Dequeue(), true);
|
||||
return;
|
||||
}
|
||||
ProducingRemoveQueue.Enqueue(component.Owner);
|
||||
UpdateRunningAppearance(component.Owner, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the machine sprite to either play the running animation
|
||||
/// or stop.
|
||||
/// </summary>
|
||||
private void UpdateRunningAppearance(EntityUid uid, bool isRunning)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
return;
|
||||
|
||||
appearance.SetData(LatheVisuals.IsRunning, isRunning);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the machine sprite to play the inserting animation
|
||||
/// and sets the color of the inserted mat if applicable
|
||||
/// </summary>
|
||||
private void UpdateInsertingAppearance(EntityUid uid, bool isInserting, Color? color = null)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
return;
|
||||
|
||||
appearance.SetData(LatheVisuals.IsInserting, isInserting);
|
||||
if (color != null)
|
||||
appearance.SetData(LatheVisuals.InsertingColor, color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles all the button presses in the lathe UI
|
||||
/// </summary>
|
||||
private void UserInterfaceOnOnReceiveMessage(EntityUid uid, LatheComponent component, ServerBoundUserInterfaceMessage message)
|
||||
{
|
||||
if (TryComp<ApcPowerReceiverComponent>(uid, out var receiver) && !receiver.Powered)
|
||||
return;
|
||||
|
||||
switch (message.Message)
|
||||
{
|
||||
case LatheQueueRecipeMessage msg:
|
||||
_prototypeManager.TryIndex(msg.ID, out LatheRecipePrototype? recipe);
|
||||
if (recipe != null!)
|
||||
for (var i = 0; i < msg.Quantity; i++)
|
||||
{
|
||||
component.Queue.Enqueue(recipe);
|
||||
component.UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue(component)));
|
||||
}
|
||||
if (!HasComp<LatheProducingComponent>(component.Owner) && component.Queue.Count > 0)
|
||||
Produce(component, component.Queue.Dequeue());
|
||||
|
||||
break;
|
||||
case LatheSyncRequestMessage _:
|
||||
if (!HasComp<MaterialStorageComponent>(uid)) return;
|
||||
component.UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue(component)));
|
||||
if (component.ProducingRecipe != null)
|
||||
component.UserInterface?.SendMessage(new LatheProducingRecipeMessage(component.ProducingRecipe.ID));
|
||||
break;
|
||||
|
||||
case LatheServerSelectionMessage _:
|
||||
if (!TryComp(uid, out ResearchClientComponent? researchClient)) return;
|
||||
researchClient.OpenUserInterface(message.Session);
|
||||
break;
|
||||
|
||||
case LatheServerSyncMessage _:
|
||||
if (!TryComp(uid, out TechnologyDatabaseComponent? database)
|
||||
|| !TryComp(uid, out ProtolatheDatabaseComponent? protoDatabase)) return;
|
||||
|
||||
if (database.SyncWithServer())
|
||||
protoDatabase.Sync();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the prototypes in the lathe's construction queue
|
||||
/// </summary>
|
||||
private Queue<string> GetIdQueue(LatheComponent lathe)
|
||||
{
|
||||
var queue = new Queue<string>();
|
||||
foreach (var recipePrototype in lathe.Queue)
|
||||
{
|
||||
queue.Enqueue(recipePrototype.ID);
|
||||
}
|
||||
return queue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user