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:
Rane
2022-04-17 03:34:14 -04:00
committed by GitHub
parent 5f9cb8271d
commit 93cdca4f82
70 changed files with 781 additions and 1183 deletions

View File

@@ -0,0 +1,94 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Lathe;
/// <summary>
/// Sent to the server to sync material storage and the recipe queue.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheSyncRequestMessage : BoundUserInterfaceMessage
{
public LatheSyncRequestMessage()
{
}
}
/// <summary>
/// Sent to the server to sync the lathe's technology database with the research server.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheServerSyncMessage : BoundUserInterfaceMessage
{
public LatheServerSyncMessage()
{
}
}
/// <summary>
/// Sent to the server to open the ResearchClient UI.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheServerSelectionMessage : BoundUserInterfaceMessage
{
public LatheServerSelectionMessage()
{
}
}
/// <summary>
/// Sent to the client when the lathe is producing a recipe.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheProducingRecipeMessage : BoundUserInterfaceMessage
{
public readonly string ID;
public LatheProducingRecipeMessage(string id)
{
ID = id;
}
}
/// <summary>
/// Sent to the client when the lathe stopped/finished producing a recipe.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheStoppedProducingRecipeMessage : BoundUserInterfaceMessage
{
public LatheStoppedProducingRecipeMessage()
{
}
}
/// <summary>
/// Sent to the client to let it know about the recipe queue.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheFullQueueMessage : BoundUserInterfaceMessage
{
public readonly Queue<string> Recipes;
public LatheFullQueueMessage(Queue<string> recipes)
{
Recipes = recipes;
}
}
/// <summary>
/// Sent to the server when a client queues a new recipe.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheQueueRecipeMessage : BoundUserInterfaceMessage
{
public readonly string ID;
public readonly int Quantity;
public LatheQueueRecipeMessage(string id, int quantity)
{
ID = id;
Quantity = quantity;
}
}
[NetSerializable, Serializable]
public enum LatheUiKey
{
Key,
}

View File

@@ -1,17 +0,0 @@
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.Lathe
{
[Serializable, NetSerializable]
public enum LatheVisualState
{
Idle,
Producing,
InsertingMetal,
InsertingGlass,
InsertingGold,
InsertingPlasma,
InsertingPlastic
}
}

View File

@@ -0,0 +1,17 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Lathe
{
[Serializable, NetSerializable]
/// <summary>
/// Stores bools for if the machine is on
/// and if it's currently running and/or inserting.
/// Used for the visualizer
/// </summary>
public enum LatheVisuals : byte
{
IsRunning,
IsInserting,
InsertingColor
}
}

View File

@@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using Content.Shared.Research.Prototypes;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Lathe
{
@@ -24,7 +19,7 @@ namespace Content.Shared.Lathe
foreach (var (material, amount) in recipe.RequiredMaterials)
{
if (storage[material] <= (amount * quantity)) return false;
if (storage[material] < (amount * quantity)) return false;
}
return true;
@@ -34,98 +29,5 @@ namespace Content.Shared.Lathe
{
return PrototypeManager.TryIndex(id, out LatheRecipePrototype? recipe) && CanProduce(recipe, quantity);
}
/// <summary>
/// Sent to the server to sync material storage and the recipe queue.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheSyncRequestMessage : BoundUserInterfaceMessage
{
public LatheSyncRequestMessage()
{
}
}
/// <summary>
/// Sent to the server to sync the lathe's technology database with the research server.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheServerSyncMessage : BoundUserInterfaceMessage
{
public LatheServerSyncMessage()
{
}
}
/// <summary>
/// Sent to the server to open the ResearchClient UI.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheServerSelectionMessage : BoundUserInterfaceMessage
{
public LatheServerSelectionMessage()
{
}
}
/// <summary>
/// Sent to the client when the lathe is producing a recipe.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheProducingRecipeMessage : BoundUserInterfaceMessage
{
public readonly string ID;
public LatheProducingRecipeMessage(string id)
{
ID = id;
}
}
/// <summary>
/// Sent to the client when the lathe stopped/finished producing a recipe.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheStoppedProducingRecipeMessage : BoundUserInterfaceMessage
{
public LatheStoppedProducingRecipeMessage()
{
}
}
/// <summary>
/// Sent to the client to let it know about the recipe queue.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheFullQueueMessage : BoundUserInterfaceMessage
{
public readonly Queue<string> Recipes;
public LatheFullQueueMessage(Queue<string> recipes)
{
Recipes = recipes;
}
}
/// <summary>
/// Sent to the server when a client queues a new recipe.
/// </summary>
[Serializable, NetSerializable]
public sealed class LatheQueueRecipeMessage : BoundUserInterfaceMessage
{
public readonly string ID;
public readonly int Quantity;
public LatheQueueRecipeMessage(string id, int quantity)
{
ID = id;
Quantity = quantity;
}
}
[NetSerializable, Serializable]
public enum LatheUiKey
{
Key,
}
}
}