Migrate Lathe Material Ejection Code to MaterialStorage (#23199)

* SS14-23184 Migrate Lathe Material Ejection Code to MaterialStorage

The lathe material ejection code acts as a do-nothing
man-in-the-middle system that does work that would be
reasonable for any MaterialStorage-using machine to
use. This has been fixed by migrating the ejection
code to MaterialStorage, allowing anything that uses
the system to eject mats it is storing.

* Fix some YAML references. Science!!
This commit is contained in:
Hannah Giovanna Dawson
2023-12-31 01:08:33 +00:00
committed by GitHub
parent ec82a05df9
commit f850047341
7 changed files with 58 additions and 62 deletions

View File

@@ -47,12 +47,6 @@ namespace Content.Shared.Lathe
[ViewVariables]
public LatheRecipePrototype? CurrentRecipe;
/// <summary>
/// Whether the lathe can eject the materials stored within it
/// </summary>
[DataField]
public bool CanEjectStoredMaterials = true;
#region MachineUpgrading
/// <summary>
/// A modifier that changes how long it takes to print a recipe

View File

@@ -1,16 +0,0 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Lathe;
[Serializable, NetSerializable]
public sealed class LatheEjectMaterialMessage : BoundUserInterfaceMessage
{
public string Material;
public int SheetsToExtract;
public LatheEjectMaterialMessage(string material, int sheetsToExtract)
{
Material = material;
SheetsToExtract = sheetsToExtract;
}
}

View File

@@ -61,6 +61,12 @@ public sealed partial class MaterialStorageComponent : Component
/// </summary>
[DataField]
public TimeSpan InsertionTime = TimeSpan.FromSeconds(0.79f); // 0.01 off for animation timing
/// <summary>
/// Whether the storage can eject the materials stored within it
/// </summary>
[DataField]
public bool CanEjectStoredMaterials = true;
}
[Serializable, NetSerializable]
@@ -94,3 +100,20 @@ public record struct GetMaterialWhitelistEvent(EntityUid Storage)
public List<ProtoId<MaterialPrototype>> Whitelist = new();
}
/// <summary>
/// Message sent to try and eject a material from a storage
/// </summary>
[Serializable, NetSerializable]
public sealed class EjectMaterialMessage : BoundUserInterfaceMessage
{
public string Material;
public int SheetsToExtract;
public EjectMaterialMessage(string material, int sheetsToExtract)
{
Material = material;
SheetsToExtract = sheetsToExtract;
}
}