Files
tbd-station-14/Content.Shared/Lathe/LatheComponent.cs
deltanedas 1f5fab5761 move lathe recipes into packs (easier for forks and maintaining) (#33095)
* add LatheRecipePackPrototype

* change Lathe and EmagLathe to use packs

* add AddRecipesFromPacks helper to SharedLatheSystem

* update lathe logic to work with packs and clean up some stuff

* migrate individual recipes to recipe packs

* update client

* remove node/artifact scanner from techs

* :trollface:

* fix test and make it include emag recipes

* add test that every dynamic recipe must be researched

* pro

* fix

* fix

* fix all tests, genuinely good test i wonder who made it

* add unused uranium and incendiary drozd mags to tech and lathe

* add recipes

* add incendiary prototype

* undo some changes

* troll

* :trollface:

* true

Co-authored-by: pathetic meowmeow <uhhadd@gmail.com>

* shitmed real

Co-authored-by: pathetic meowmeow <uhhadd@gmail.com>

* update funny test

* :trollface:

* :trollface:

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: pathetic meowmeow <uhhadd@gmail.com>
2025-02-07 19:22:49 +01:00

102 lines
3.0 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();
/// <summary>
/// The lathe's construction queue
/// </summary>
[DataField]
public List<LatheRecipePrototype> Queue = new();
/// <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;
#endregion
}
public sealed class LatheGetRecipesEvent : EntityEventArgs
{
public readonly EntityUid Lathe;
public bool getUnavailable;
public HashSet<ProtoId<LatheRecipePrototype>> Recipes = new();
public LatheGetRecipesEvent(EntityUid lathe, bool forced)
{
Lathe = lathe;
getUnavailable = forced;
}
}
/// <summary>
/// Event raised on a lathe when it starts producing a recipe.
/// </summary>
[ByRefEvent]
public readonly record struct LatheStartPrintingEvent(LatheRecipePrototype Recipe);
}