LatheComponent.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. using Content.Shared.Construction.Prototypes;
  2. using Content.Shared.Lathe.Prototypes;
  3. using Content.Shared.Research.Prototypes;
  4. using Robust.Shared.Audio;
  5. using Robust.Shared.GameStates;
  6. using Robust.Shared.Prototypes;
  7. namespace Content.Shared.Lathe
  8. {
  9. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  10. public sealed partial class LatheComponent : Component
  11. {
  12. /// <summary>
  13. /// All of the recipe packs that the lathe has by default
  14. /// </summary>
  15. [DataField]
  16. public List<ProtoId<LatheRecipePackPrototype>> StaticPacks = new();
  17. /// <summary>
  18. /// All of the recipe packs that the lathe is capable of researching
  19. /// </summary>
  20. [DataField]
  21. public List<ProtoId<LatheRecipePackPrototype>> DynamicPacks = new();
  22. /// <summary>
  23. /// The lathe's construction queue
  24. /// </summary>
  25. [DataField]
  26. public List<LatheRecipePrototype> Queue = new();
  27. /// <summary>
  28. /// The sound that plays when the lathe is producing an item, if any
  29. /// </summary>
  30. [DataField]
  31. public SoundSpecifier? ProducingSound;
  32. [DataField]
  33. public string? ReagentOutputSlotId;
  34. /// <summary>
  35. /// The default amount that's displayed in the UI for selecting the print amount.
  36. /// </summary>
  37. [DataField, AutoNetworkedField]
  38. public int DefaultProductionAmount = 1;
  39. #region Visualizer info
  40. [DataField]
  41. public string? IdleState;
  42. [DataField]
  43. public string? RunningState;
  44. [DataField]
  45. public string? UnlitIdleState;
  46. [DataField]
  47. public string? UnlitRunningState;
  48. #endregion
  49. /// <summary>
  50. /// The recipe the lathe is currently producing
  51. /// </summary>
  52. [ViewVariables]
  53. public LatheRecipePrototype? CurrentRecipe;
  54. #region MachineUpgrading
  55. /// <summary>
  56. /// A modifier that changes how long it takes to print a recipe
  57. /// </summary>
  58. [DataField, ViewVariables(VVAccess.ReadWrite)]
  59. public float TimeMultiplier = 1;
  60. /// <summary>
  61. /// A modifier that changes how much of a material is needed to print a recipe
  62. /// </summary>
  63. [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
  64. public float MaterialUseMultiplier = 1;
  65. #endregion
  66. }
  67. public sealed class LatheGetRecipesEvent : EntityEventArgs
  68. {
  69. public readonly EntityUid Lathe;
  70. public bool getUnavailable;
  71. public HashSet<ProtoId<LatheRecipePrototype>> Recipes = new();
  72. public LatheGetRecipesEvent(EntityUid lathe, bool forced)
  73. {
  74. Lathe = lathe;
  75. getUnavailable = forced;
  76. }
  77. }
  78. /// <summary>
  79. /// Event raised on a lathe when it starts producing a recipe.
  80. /// </summary>
  81. [ByRefEvent]
  82. public readonly record struct LatheStartPrintingEvent(LatheRecipePrototype Recipe);
  83. }