172 lines
5.7 KiB
C#
172 lines
5.7 KiB
C#
using Content.Shared.Construction.Prototypes;
|
|
using Content.Shared.Lathe.Prototypes;
|
|
using Content.Shared.Research.Prototypes;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.Lathe
|
|
{
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
|
public sealed partial class LatheComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// All of the recipe packs that the lathe has by default
|
|
/// </summary>
|
|
[DataField]
|
|
public List<ProtoId<LatheRecipePackPrototype>> StaticPacks = new();
|
|
|
|
/// <summary>
|
|
/// All of the recipe packs that the lathe is capable of researching
|
|
/// </summary>
|
|
[DataField]
|
|
public List<ProtoId<LatheRecipePackPrototype>> DynamicPacks = new();
|
|
// Note that this shouldn't be modified dynamically.
|
|
// I.e., this + the static recipies should represent all recipies that the lathe can ever make
|
|
// Otherwise the material arbitrage test and/or LatheSystem.GetAllBaseRecipes needs to be updated
|
|
|
|
/// <summary>
|
|
/// The lathe's construction queue
|
|
/// </summary>
|
|
[DataField]
|
|
public List<LatheRecipeBatch> Queue = new(); // Frontier: LatheRecipePrototype<LatheRecipeBatch
|
|
|
|
/// <summary>
|
|
/// The sound that plays when the lathe is producing an item, if any
|
|
/// </summary>
|
|
[DataField]
|
|
public SoundSpecifier? ProducingSound;
|
|
|
|
[DataField]
|
|
public string? ReagentOutputSlotId;
|
|
|
|
/// <summary>
|
|
/// The default amount that's displayed in the UI for selecting the print amount.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public int DefaultProductionAmount = 1;
|
|
|
|
#region Visualizer info
|
|
[DataField]
|
|
public string? IdleState;
|
|
|
|
[DataField]
|
|
public string? RunningState;
|
|
|
|
[DataField]
|
|
public string? UnlitIdleState;
|
|
|
|
[DataField]
|
|
public string? UnlitRunningState;
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// The recipe the lathe is currently producing
|
|
/// </summary>
|
|
[ViewVariables]
|
|
public LatheRecipePrototype? CurrentRecipe;
|
|
|
|
#region MachineUpgrading
|
|
/// <summary>
|
|
/// A modifier that changes how long it takes to print a recipe
|
|
/// </summary>
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
|
public float TimeMultiplier = 1;
|
|
|
|
/// <summary>
|
|
/// A modifier that changes how much of a material is needed to print a recipe
|
|
/// </summary>
|
|
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
|
public float MaterialUseMultiplier = 1;
|
|
|
|
/// <summary>
|
|
/// A modifier that changes how long it takes to print a recipe
|
|
/// </summary>
|
|
[DataField, ViewVariables(VVAccess.ReadOnly), AutoNetworkedField]
|
|
public float FinalTimeMultiplier = 1;
|
|
|
|
/// <summary>
|
|
/// A modifier that changes how much of a material is needed to print a recipe
|
|
/// </summary>
|
|
[DataField, ViewVariables(VVAccess.ReadOnly), AutoNetworkedField]
|
|
public float FinalMaterialUseMultiplier = 1;
|
|
|
|
public const float DefaultPartRatingMaterialUseMultiplier = 0.85f; // Frontier: restored for machine parts
|
|
|
|
//Frontier Upgrade Code Restore
|
|
/// <summary>
|
|
/// The machine part that reduces how long it takes to print a recipe.
|
|
/// </summary>
|
|
[DataField]
|
|
public ProtoId<MachinePartPrototype> MachinePartPrintSpeed = "Manipulator";
|
|
|
|
/// <summary>
|
|
/// The value that is used to calculate the modified <see cref="TimeMultiplier"/>
|
|
/// </summary>
|
|
[DataField]
|
|
public float PartRatingPrintTimeMultiplier = 0.5f;
|
|
|
|
/// <summary>
|
|
/// The machine part that reduces how much material it takes to print a recipe.
|
|
/// </summary>
|
|
[DataField]
|
|
public ProtoId<MachinePartPrototype> MachinePartMaterialUse = "MatterBin";
|
|
|
|
// Frontier: restored for machine part upgrades
|
|
/// <summary>
|
|
/// The value that is used to calculate the modifier <see cref="MaterialUseMultiplier"/>
|
|
/// </summary>
|
|
[DataField]
|
|
public float PartRatingMaterialUseMultiplier = DefaultPartRatingMaterialUseMultiplier;
|
|
// End Frontier
|
|
|
|
// Frontier: restored for machine part upgrades
|
|
/// <summary>
|
|
/// If not null, finite and non-negative, modifies values on spawned items
|
|
/// </summary>
|
|
[DataField]
|
|
public float? ProductValueModifier = 0.3f;
|
|
// End Frontier
|
|
#endregion
|
|
}
|
|
|
|
public sealed class LatheGetRecipesEvent : EntityEventArgs
|
|
{
|
|
public readonly EntityUid Lathe;
|
|
public readonly LatheComponent Comp;
|
|
|
|
public bool GetUnavailable;
|
|
|
|
public HashSet<ProtoId<LatheRecipePrototype>> Recipes = new();
|
|
|
|
public LatheGetRecipesEvent(Entity<LatheComponent> lathe, bool forced)
|
|
{
|
|
(Lathe, Comp) = lathe;
|
|
GetUnavailable = forced;
|
|
}
|
|
}
|
|
|
|
// Frontier: batch lathe recipes
|
|
[Serializable]
|
|
public sealed partial class LatheRecipeBatch : EntityEventArgs
|
|
{
|
|
public LatheRecipePrototype Recipe;
|
|
public int ItemsPrinted;
|
|
public int ItemsRequested;
|
|
|
|
public LatheRecipeBatch(LatheRecipePrototype recipe, int itemsPrinted, int itemsRequested)
|
|
{
|
|
Recipe = recipe;
|
|
ItemsPrinted = itemsPrinted;
|
|
ItemsRequested = itemsRequested;
|
|
}
|
|
}
|
|
// End Frontier
|
|
|
|
/// <summary>
|
|
/// Event raised on a lathe when it starts producing a recipe.
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public readonly record struct LatheStartPrintingEvent(LatheRecipePrototype Recipe);
|
|
}
|