2022-10-30 03:12:11 -04:00
|
|
|
using Content.Shared.Construction.Prototypes;
|
2022-09-16 19:49:05 -04:00
|
|
|
using Content.Shared.Research.Prototypes;
|
|
|
|
|
using Robust.Shared.Audio;
|
|
|
|
|
using Robust.Shared.GameStates;
|
2023-09-28 16:20:29 -07:00
|
|
|
using Robust.Shared.Prototypes;
|
2022-09-16 19:49:05 -04:00
|
|
|
|
|
|
|
|
namespace Content.Shared.Lathe
|
|
|
|
|
{
|
2023-09-28 16:20:29 -07:00
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class LatheComponent : Component
|
2022-09-16 19:49:05 -04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// All of the recipes that the lathe has by default
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
|
|
|
|
public List<ProtoId<LatheRecipePrototype>> StaticRecipes = new();
|
2022-09-16 19:49:05 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// All of the recipes that the lathe is capable of researching
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
|
|
|
|
public List<ProtoId<LatheRecipePrototype>> DynamicRecipes = new();
|
2022-09-16 19:49:05 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The lathe's construction queue
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
2022-09-16 19:49:05 -04:00
|
|
|
public List<LatheRecipePrototype> Queue = new();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The sound that plays when the lathe is producing an item, if any
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
2022-09-16 19:49:05 -04:00
|
|
|
public SoundSpecifier? ProducingSound;
|
2023-09-28 16:20:29 -07:00
|
|
|
|
2022-09-16 19:49:05 -04:00
|
|
|
#region Visualizer info
|
2024-01-30 21:50:40 -05:00
|
|
|
[DataField]
|
|
|
|
|
public string? IdleState;
|
2022-09-16 19:49:05 -04:00
|
|
|
|
2024-01-30 21:50:40 -05:00
|
|
|
[DataField]
|
|
|
|
|
public string? RunningState;
|
2022-09-16 19:49:05 -04:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The recipe the lathe is currently producing
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public LatheRecipePrototype? CurrentRecipe;
|
|
|
|
|
|
2022-10-30 03:12:11 -04:00
|
|
|
#region MachineUpgrading
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A modifier that changes how long it takes to print a recipe
|
|
|
|
|
/// </summary>
|
2023-12-30 11:18:58 -05:00
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
2022-10-30 03:12:11 -04:00
|
|
|
public float TimeMultiplier = 1;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A modifier that changes how much of a material is needed to print a recipe
|
|
|
|
|
/// </summary>
|
2023-12-30 11:18:58 -05:00
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
2022-10-30 03:12:11 -04:00
|
|
|
public float MaterialUseMultiplier = 1;
|
|
|
|
|
|
2023-04-10 00:38:20 -04:00
|
|
|
public const float DefaultPartRatingMaterialUseMultiplier = 0.85f;
|
2022-10-30 03:12:11 -04:00
|
|
|
#endregion
|
2022-09-16 19:49:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public sealed class LatheGetRecipesEvent : EntityEventArgs
|
|
|
|
|
{
|
|
|
|
|
public readonly EntityUid Lathe;
|
|
|
|
|
|
2024-01-02 11:11:13 +04:00
|
|
|
public bool getUnavailable;
|
|
|
|
|
|
2024-12-14 13:02:28 +03:00
|
|
|
public HashSet<ProtoId<LatheRecipePrototype>> Recipes = new(); // WD Ahead of wizden
|
2022-09-16 19:49:05 -04:00
|
|
|
|
2024-01-02 11:11:13 +04:00
|
|
|
public LatheGetRecipesEvent(EntityUid lathe, bool forced)
|
2022-09-16 19:49:05 -04:00
|
|
|
{
|
|
|
|
|
Lathe = lathe;
|
2024-01-02 11:11:13 +04:00
|
|
|
getUnavailable = forced;
|
2022-09-16 19:49:05 -04:00
|
|
|
}
|
|
|
|
|
}
|
2023-12-30 11:18:58 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Event raised on a lathe when it starts producing a recipe.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ByRefEvent]
|
|
|
|
|
public readonly record struct LatheStartPrintingEvent(LatheRecipePrototype Recipe);
|
2022-09-16 19:49:05 -04:00
|
|
|
}
|