using Content.Shared.Nutrition.Components; using Content.Shared.Storage; using Content.Shared.Whitelist; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.Nutrition.AnimalHusbandry; /// /// This is used for simple animal husbandry. Entities with this component, /// given they are next to a particular entity that fulfills a whitelist, /// can create several "child" entities. /// [RegisterComponent] public sealed partial class ReproductiveComponent : Component { /// /// The next time when breeding will be attempted. /// [DataField("nextBreedAttempt", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)] public TimeSpan NextBreedAttempt; /// /// Minimum length between each attempt to breed. /// [DataField("minBreedAttemptInterval"), ViewVariables(VVAccess.ReadWrite)] public TimeSpan MinBreedAttemptInterval = TimeSpan.FromSeconds(45); /// /// Maximum length between each attempt to breed. /// [DataField("maxBreedAttemptInterval"), ViewVariables(VVAccess.ReadWrite)] public TimeSpan MaxBreedAttemptInterval = TimeSpan.FromSeconds(60); /// /// How close to a partner an entity must be in order to breed. /// Unrealistically long. /// [DataField("breedRange"), ViewVariables(VVAccess.ReadWrite)] public float BreedRange = 3f; /// /// How many other entities with this component are allowed in range before we stop. /// [DataField("capacity"), ViewVariables(VVAccess.ReadWrite)] public int Capacity = 6; /// /// The chance that, on a given attempt, /// for each valid partner, the entity will breed. /// [DataField("breedChance"), ViewVariables(VVAccess.ReadWrite)] public float BreedChance = 0.15f; /// /// Entity prototypes for what type of /// offspring can be produced by this entity. /// [DataField("offspring", required: true)] public List Offspring = default!; /// /// Whether or not this entity has bred successfully /// and will produce offspring imminently /// [DataField("gestating")] public bool Gestating; /// /// When gestation will end. /// Null if is false /// [DataField("gestationEndTime"), ViewVariables(VVAccess.ReadWrite)] public TimeSpan? GestationEndTime; /// /// How long it takes the entity after breeding /// to produce offspring /// [DataField("gestationDuration"), ViewVariables(VVAccess.ReadWrite)] public TimeSpan GestationDuration = TimeSpan.FromMinutes(1.5); /// /// How much hunger is consumed when an entity /// gives birth. A balancing tool to require feeding. /// [DataField("hungerPerBirth"), ViewVariables(VVAccess.ReadWrite)] public float HungerPerBirth = 75f; /// /// Popup shown when an entity gives birth. /// Configurable for things like laying eggs. /// [DataField("birthPopup"), ViewVariables(VVAccess.ReadWrite)] public string BirthPopup = "reproductive-birth-popup"; /// /// Whether or not the offspring should be made into "infants". /// [DataField("makeOffspringInfant"), ViewVariables(VVAccess.ReadWrite)] public bool MakeOffspringInfant = true; /// /// An entity whitelist for what entities /// can be this one's partner. /// [DataField("partnerWhitelist", required: true)] public EntityWhitelist PartnerWhitelist = default!; }