Animals obey conservation of matter unless they are undead (#21922)
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
using Content.Server.Animals.Systems;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
|
||||
namespace Content.Server.Animals.Components
|
||||
|
||||
/// <summary>
|
||||
/// Lets an entity produce milk. Uses hunger if present.
|
||||
/// </summary>
|
||||
{
|
||||
[RegisterComponent, Access(typeof(UdderSystem))]
|
||||
internal sealed partial class UdderComponent : Component
|
||||
@@ -11,31 +17,37 @@ namespace Content.Server.Animals.Components
|
||||
/// <summary>
|
||||
/// The reagent to produce.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField("reagentId", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentPrototype>))]
|
||||
public string ReagentId = "Milk";
|
||||
[DataField, ViewVariables(VVAccess.ReadOnly)]
|
||||
public ProtoId<ReagentPrototype> ReagentId = "Milk";
|
||||
|
||||
/// <summary>
|
||||
/// The solution to add reagent to.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField("targetSolution")]
|
||||
public string TargetSolutionName = "udder";
|
||||
[DataField, ViewVariables(VVAccess.ReadOnly)]
|
||||
public string Solution = "udder";
|
||||
|
||||
/// <summary>
|
||||
/// The amount of reagent to be generated on update.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField("quantity")]
|
||||
public FixedPoint2 QuantityPerUpdate = 1;
|
||||
[DataField, ViewVariables(VVAccess.ReadOnly)]
|
||||
public FixedPoint2 QuantityPerUpdate = 25;
|
||||
|
||||
/// <summary>
|
||||
/// The time between updates (in seconds).
|
||||
/// The amount of nutrient consumed on update.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[DataField("updateRate")]
|
||||
public float UpdateRate = 5;
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public float HungerUsage = 10f;
|
||||
|
||||
public float AccumulatedFrameTime;
|
||||
/// <summary>
|
||||
/// How long to wait before producing.
|
||||
/// </summary>
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan GrowthDelay = TimeSpan.FromMinutes(1);
|
||||
|
||||
/// <summary>
|
||||
/// When to next try to produce.
|
||||
/// </summary>
|
||||
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan NextGrowth = TimeSpan.FromSeconds(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user