2022-07-09 02:48:16 -07:00
|
|
|
using Content.Shared.Storage;
|
2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2023-09-08 18:16:05 -07:00
|
|
|
using Robust.Shared.Prototypes;
|
2022-07-09 02:48:16 -07:00
|
|
|
|
|
|
|
|
namespace Content.Server.Animals.Components;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This component handles animals which lay eggs (or some other item) on a timer, using up hunger to do so.
|
|
|
|
|
/// It also grants an action to players who are controlling these entities, allowing them to do it manually.
|
|
|
|
|
/// </summary>
|
2023-12-11 04:20:41 +01:00
|
|
|
|
2022-07-09 02:48:16 -07:00
|
|
|
[RegisterComponent]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class EggLayerComponent : Component
|
2022-07-09 02:48:16 -07:00
|
|
|
{
|
2023-12-11 04:20:41 +01:00
|
|
|
[DataField]
|
|
|
|
|
public EntProtoId EggLayAction = "ActionAnimalLayEgg";
|
2022-07-09 02:48:16 -07:00
|
|
|
|
2023-12-11 04:20:41 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// The amount of nutrient consumed on update.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
2022-07-09 02:48:16 -07:00
|
|
|
public float HungerUsage = 60f;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Minimum cooldown used for the automatic egg laying.
|
|
|
|
|
/// </summary>
|
2023-12-11 04:20:41 +01:00
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
2022-07-09 02:48:16 -07:00
|
|
|
public float EggLayCooldownMin = 60f;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Maximum cooldown used for the automatic egg laying.
|
|
|
|
|
/// </summary>
|
2023-12-11 04:20:41 +01:00
|
|
|
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
2022-07-09 02:48:16 -07:00
|
|
|
public float EggLayCooldownMax = 120f;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Set during component init.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public float CurrentEggLayCooldown;
|
|
|
|
|
|
2023-12-11 04:20:41 +01:00
|
|
|
[DataField(required: true), ViewVariables(VVAccess.ReadWrite)]
|
2022-07-09 02:48:16 -07:00
|
|
|
public List<EntitySpawnEntry> EggSpawn = default!;
|
|
|
|
|
|
2023-12-11 04:20:41 +01:00
|
|
|
[DataField]
|
2022-07-09 02:48:16 -07:00
|
|
|
public SoundSpecifier EggLaySound = new SoundPathSpecifier("/Audio/Effects/pop.ogg");
|
|
|
|
|
|
2023-12-11 04:20:41 +01:00
|
|
|
[DataField]
|
2022-07-09 02:48:16 -07:00
|
|
|
public float AccumulatedFrametime;
|
2023-09-23 04:49:39 -04:00
|
|
|
|
|
|
|
|
[DataField] public EntityUid? Action;
|
2022-07-09 02:48:16 -07:00
|
|
|
}
|