using Robust.Shared.GameStates; namespace Content.Shared._CP14.Farming; /// /// The backbone of any plant. Provides common variables for the plant to other components, and a link to the soil /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), Access(typeof(CP14SharedFarmingSystem))] public sealed partial class CP14PlantComponent : Component { /// /// Soil link. May be null, as not all plants in the world grow on entity soil (e.g. wild shrubs) /// public EntityUid? SoilUid; /// /// The ability to consume a resource for growing /// [DataField] public float Energy = 0f; [DataField] public float EnergyMax = 100f; /// /// resource consumed for growth /// [DataField] public float Resource = 0f; [DataField] public float ResourceMax = 100f; /// /// Plant growth status, 0 to 1 /// [DataField, AutoNetworkedField] public float GrowthLevel = 0f; [DataField(serverOnly: true)] public float UpdateFrequency = 60f; [DataField(serverOnly: true)] public TimeSpan NextUpdateTime = TimeSpan.Zero; [DataField(serverOnly: true)] public TimeSpan Age = TimeSpan.Zero; } /// /// Is called periodically at random intervals on the plant. /// public sealed class CP14PlantUpdateEvent : EntityEventArgs { public readonly Entity Plant; public float EnergyDelta = 0f; public float ResourceDelta = 0f; public CP14PlantUpdateEvent(Entity comp) { Plant = comp; } } /// /// is called after CP14PlantUpdateEvent when all value changes have already been calculated. /// public sealed class CP14AfterPlantUpdateEvent : EntityEventArgs { public readonly Entity Plant; public CP14AfterPlantUpdateEvent(Entity comp) { Plant = comp; } }