EggLayerComponent.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Content.Server.Animals.Systems;
  2. using Content.Shared.Storage;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Server.Animals.Components;
  6. /// <summary>
  7. /// This component handles animals which lay eggs (or some other item) on a timer, using up hunger to do so.
  8. /// It also grants an action to players who are controlling these entities, allowing them to do it manually.
  9. /// </summary>
  10. [RegisterComponent, Access(typeof(EggLayerSystem)), AutoGenerateComponentPause]
  11. public sealed partial class EggLayerComponent : Component
  12. {
  13. /// <summary>
  14. /// The item that gets laid/spawned, retrieved from animal prototype.
  15. /// </summary>
  16. [DataField(required: true)]
  17. public List<EntitySpawnEntry> EggSpawn = new();
  18. /// <summary>
  19. /// Player action.
  20. /// </summary>
  21. [DataField]
  22. public EntProtoId EggLayAction = "ActionAnimalLayEgg";
  23. [DataField]
  24. public SoundSpecifier EggLaySound = new SoundPathSpecifier("/Audio/Effects/pop.ogg");
  25. /// <summary>
  26. /// Minimum cooldown used for the automatic egg laying.
  27. /// </summary>
  28. [DataField]
  29. public float EggLayCooldownMin = 60f;
  30. /// <summary>
  31. /// Maximum cooldown used for the automatic egg laying.
  32. /// </summary>
  33. [DataField]
  34. public float EggLayCooldownMax = 120f;
  35. /// <summary>
  36. /// The amount of nutrient consumed on update.
  37. /// </summary>
  38. [DataField]
  39. public float HungerUsage = 60f;
  40. [DataField] public EntityUid? Action;
  41. /// <summary>
  42. /// When to next try to produce.
  43. /// </summary>
  44. [DataField, AutoPausedField]
  45. public TimeSpan NextGrowth = TimeSpan.Zero;
  46. }