SericultureComponent.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Content.Shared.Nutrition.Components;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  5. namespace Content.Shared.Sericulture;
  6. /// <summary>
  7. /// Should be applied to any mob that you want to be able to produce any material with an action and the cost of hunger.
  8. /// TODO: Probably adjust this to utilize organs?
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent, Access(typeof(SharedSericultureSystem)), AutoGenerateComponentState]
  11. public sealed partial class SericultureComponent : Component
  12. {
  13. /// <summary>
  14. /// The text that pops up whenever sericulture fails for not having enough hunger.
  15. /// </summary>
  16. [DataField("popupText")]
  17. [ViewVariables(VVAccess.ReadWrite)]
  18. [AutoNetworkedField]
  19. public string PopupText = "sericulture-failure-hunger";
  20. /// <summary>
  21. /// What will be produced at the end of the action.
  22. /// </summary>
  23. [DataField(required: true)]
  24. [ViewVariables(VVAccess.ReadWrite)]
  25. [AutoNetworkedField]
  26. public EntProtoId EntityProduced;
  27. /// <summary>
  28. /// The entity needed to actually preform sericulture. This will be granted (and removed) upon the entity's creation.
  29. /// </summary>
  30. [DataField(required: true)]
  31. [ViewVariables(VVAccess.ReadWrite)]
  32. [AutoNetworkedField]
  33. public EntProtoId Action;
  34. [AutoNetworkedField]
  35. [DataField("actionEntity")]
  36. public EntityUid? ActionEntity;
  37. /// <summary>
  38. /// How long will it take to make.
  39. /// </summary>
  40. [DataField("productionLength")]
  41. [ViewVariables(VVAccess.ReadWrite)]
  42. [AutoNetworkedField]
  43. public float ProductionLength = 3f;
  44. /// <summary>
  45. /// This will subtract (not add, don't get this mixed up) from the current hunger of the mob doing sericulture.
  46. /// </summary>
  47. [DataField("hungerCost")]
  48. [ViewVariables(VVAccess.ReadWrite)]
  49. [AutoNetworkedField]
  50. public float HungerCost = 5f;
  51. /// <summary>
  52. /// The lowest hunger threshold that this mob can be in before it's allowed to spin silk.
  53. /// </summary>
  54. [DataField("minHungerThreshold")]
  55. [ViewVariables(VVAccess.ReadWrite)]
  56. [AutoNetworkedField]
  57. public HungerThreshold MinHungerThreshold = HungerThreshold.Okay;
  58. }