Animals obey conservation of matter unless they are undead (#21922)

This commit is contained in:
Sirionaut
2023-12-11 04:20:41 +01:00
committed by GitHub
parent 07d8b14af0
commit c095b7cd4a
7 changed files with 212 additions and 161 deletions

View File

@@ -4,38 +4,47 @@ using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Animals.Components;
/// <summary>
/// Lets an animal grow a wool solution when not hungry.
/// Lets an entity produce wool fibers. Uses hunger if present.
/// </summary>
[RegisterComponent, Access(typeof(WoolySystem))]
public sealed partial class WoolyComponent : Component
{
/// <summary>
/// What reagent to grow.
/// The reagent to grow.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadOnly)]
public ProtoId<ReagentPrototype> ReagentId = "Fiber";
/// <summary>
/// How much wool to grow at every growth cycle.
/// The solution to add reagent to.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 Quantity = 25;
/// <summary>
/// What solution to add the wool reagent to.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadOnly)]
public string Solution = "wool";
/// <summary>
/// How long to wait before growing wool.
/// The amount of reagent to be generated on update.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public FixedPoint2 Quantity = 25;
/// <summary>
/// The amount of nutrient consumed on update.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float HungerUsage = 10f;
/// <summary>
/// How long to wait before growing wool.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan GrowthDelay = TimeSpan.FromMinutes(1);
/// <summary>
/// When to next try growing wool.
/// When to next try growing wool.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan NextGrowth = TimeSpan.FromSeconds(0);