using Robust.Shared.GameStates;
namespace Content.Shared._CP14.Farming.Components;
///
/// The backbone of any plant. Provides common variables for the plant to other components
///
[RegisterComponent, NetworkedComponent, AutoGenerateComponentPause, AutoGenerateComponentState(true), Access(typeof(CP14SharedFarmingSystem))]
public sealed partial class CP14PlantComponent : Component
{
///
/// The ability to consume a resource for growing
///
[DataField, AutoNetworkedField]
public float Energy = 30f;
[DataField, AutoNetworkedField]
public float EnergyMax = 100f;
///
/// resource consumed for growth
///
[DataField, AutoNetworkedField]
public float Resource = 30f;
[DataField, AutoNetworkedField]
public float ResourceMax = 100f;
///
/// Plant growth status, from 0 to 1
///
[DataField, AutoNetworkedField]
public float GrowthLevel = 0f;
[DataField]
public float UpdateFrequency = 60f;
[DataField, AutoPausedField]
public TimeSpan NextUpdateTime = TimeSpan.Zero;
[DataField(required: true)]
public string Solution = string.Empty;
}
///
/// Is called periodically at random intervals on the plant.
///
public sealed class CP14PlantUpdateEvent(Entity comp) : EntityEventArgs
{
public readonly Entity Plant = comp;
public float EnergyDelta = 0f;
public float ResourceDelta = 0f;
}
///
/// is called after CP14PlantUpdateEvent when all value changes have already been calculated.
///
public sealed class CP14AfterPlantUpdateEvent(Entity comp) : EntityEventArgs
{
public readonly Entity Plant = comp;
}