FatExtractorComponent.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using Content.Server.Nutrition.EntitySystems;
  2. using Content.Shared.Nutrition.Components;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.Prototypes;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  7. namespace Content.Server.Nutrition.Components;
  8. /// <summary>
  9. /// This is used for a machine that extracts hunger from entities and creates meat. Yum!
  10. /// </summary>
  11. [RegisterComponent, Access(typeof(FatExtractorSystem)), AutoGenerateComponentPause]
  12. public sealed partial class FatExtractorComponent : Component
  13. {
  14. /// <summary>
  15. /// Whether or not the extractor is currently extracting fat from someone
  16. /// </summary>
  17. [DataField("processing")]
  18. public bool Processing = true;
  19. /// <summary>
  20. /// How much nutrition is extracted per second.
  21. /// </summary>
  22. [DataField("nutritionPerSecond"), ViewVariables(VVAccess.ReadWrite)]
  23. public int NutritionPerSecond = 10;
  24. /// <summary>
  25. /// An accumulator which tracks extracted nutrition to determine
  26. /// when to spawn a meat.
  27. /// </summary>
  28. [DataField("nutrientAccumulator"), ViewVariables(VVAccess.ReadWrite)]
  29. public int NutrientAccumulator;
  30. /// <summary>
  31. /// How high <see cref="NutrientAccumulator"/> has to be to spawn meat
  32. /// </summary>
  33. [DataField("nutrientPerMeat"), ViewVariables(VVAccess.ReadWrite)]
  34. public int NutrientPerMeat = 30;
  35. /// <summary>
  36. /// Meat spawned by the extractor.
  37. /// </summary>
  38. [DataField("meatPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
  39. public string MeatPrototype = "FoodMeat";
  40. /// <summary>
  41. /// When the next update will occur
  42. /// </summary>
  43. [DataField("nextUpdate", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
  44. [AutoPausedField]
  45. public TimeSpan NextUpdate;
  46. /// <summary>
  47. /// How long each update takes
  48. /// </summary>
  49. [DataField("updateTime"), ViewVariables(VVAccess.ReadWrite)]
  50. public TimeSpan UpdateTime = TimeSpan.FromSeconds(1);
  51. /// <summary>
  52. /// The sound played when extracting
  53. /// </summary>
  54. [DataField("processSound")]
  55. public SoundSpecifier? ProcessSound;
  56. public EntityUid? Stream;
  57. /// <summary>
  58. /// A minium hunger threshold for extracting nutrition.
  59. /// Ignored when emagged.
  60. /// </summary>
  61. [DataField("minHungerThreshold")]
  62. public HungerThreshold MinHungerThreshold = HungerThreshold.Okay;
  63. }