Puddles & spreader refactor (#15191)
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
namespace Content.Server.Fluids.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class DrainComponent : Component
|
||||
{
|
||||
public const string SolutionName = "drainBuffer";
|
||||
|
||||
[DataField("accumulator")]
|
||||
public float Accumulator = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// How many units per second the drain can absorb from the surrounding puddles.
|
||||
/// Divided by puddles, so if there are 5 puddles this will take 1/5 from each puddle.
|
||||
/// This will stay fixed to 1 second no matter what DrainFrequency is.
|
||||
/// </summary>
|
||||
[DataField("unitsPerSecond")]
|
||||
public float UnitsPerSecond = 6f;
|
||||
|
||||
/// <summary>
|
||||
/// How many units are ejected from the buffer per second.
|
||||
/// </summary>
|
||||
[DataField("unitsDestroyedPerSecond")]
|
||||
public float UnitsDestroyedPerSecond = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// How many (unobstructed) tiles away the drain will
|
||||
/// drain puddles from.
|
||||
/// </summary>
|
||||
[DataField("range")]
|
||||
public float Range = 2f;
|
||||
|
||||
/// <summary>
|
||||
/// How often in seconds the drain checks for puddles around it.
|
||||
/// If the EntityQuery seems a bit unperformant this can be increased.
|
||||
/// </summary>
|
||||
[DataField("drainFrequency")]
|
||||
public float DrainFrequency = 1f;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,24 @@
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Server.Fluids.Components
|
||||
namespace Content.Server.Fluids.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Added to puddles that contain water so it may evaporate over time.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(PuddleSystem))]
|
||||
public sealed class EvaporationComponent : Component
|
||||
{
|
||||
[RegisterComponent]
|
||||
[Access(typeof(EvaporationSystem))]
|
||||
public sealed class EvaporationComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Is this entity actively evaporating? This toggle lets us pause evaporation under certain conditions.
|
||||
/// </summary>
|
||||
[DataField("evaporationToggle")]
|
||||
public bool EvaporationToggle = true;
|
||||
/// <summary>
|
||||
/// The next time we remove the EvaporationSystem reagent amount from this entity.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("nextTick", customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan NextTick = TimeSpan.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// The time that it will take this puddle to lose one fixed unit of solution, in seconds.
|
||||
/// </summary>
|
||||
[DataField("evaporateTime")]
|
||||
public float EvaporateTime { get; set; } = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// Name of referenced solution. Defaults to <see cref="PuddleComponent.DefaultSolutionName"/>
|
||||
/// </summary>
|
||||
[DataField("solution")]
|
||||
public string SolutionName { get; set; } = PuddleComponent.DefaultSolutionName;
|
||||
|
||||
/// <summary>
|
||||
/// Lower limit below which puddle won't evaporate. Useful when wanting to leave a stain.
|
||||
/// Defaults to evaporate completely.
|
||||
/// </summary>
|
||||
[DataField("lowerLimit")]
|
||||
public FixedPoint2 LowerLimit = FixedPoint2.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Upper limit above which puddle won't evaporate. Useful when wanting to make sure large puddle will
|
||||
/// remain forever. Defaults to 100.
|
||||
/// </summary>
|
||||
[DataField("upperLimit")]
|
||||
public FixedPoint2 UpperLimit = FixedPoint2.New(100); //TODO: Consider setting this back to PuddleComponent.DefaultOverflowVolume once that behaviour is fixed.
|
||||
|
||||
/// <summary>
|
||||
/// The time accumulated since the start.
|
||||
/// </summary>
|
||||
[DataField("accumulator")]
|
||||
public float Accumulator = 0f;
|
||||
}
|
||||
/// <summary>
|
||||
/// How much evaporation occurs every tick.
|
||||
/// </summary>
|
||||
[DataField("evaporationAmount")]
|
||||
public FixedPoint2 EvaporationAmount = FixedPoint2.New(0.3);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Content.Server.Fluids.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Used to track evaporation sparkles so we can delete if necessary.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class EvaporationSparkleComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Server.Fluids.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
[Access(typeof(FluidSpreaderSystem))]
|
||||
public sealed class FluidMapDataComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// At what time will <see cref="FluidSpreaderSystem"/> be checked next
|
||||
/// </summary>
|
||||
[DataField("goalTime", customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan GoalTime;
|
||||
|
||||
/// <summary>
|
||||
/// Delay between two runs of <see cref="FluidSpreaderSystem"/>
|
||||
/// </summary>
|
||||
[DataField("delay")]
|
||||
public TimeSpan Delay = TimeSpan.FromSeconds(2);
|
||||
|
||||
/// <summary>
|
||||
/// Puddles to be expanded.
|
||||
/// </summary>
|
||||
[DataField("puddles")] public HashSet<EntityUid> Puddles = new();
|
||||
|
||||
/// <summary>
|
||||
/// Convenience method for setting GoalTime to <paramref name="start"/> + <see cref="Delay"/>
|
||||
/// </summary>
|
||||
/// <param name="start">Time to which to add <see cref="Delay"/>, defaults to current <see cref="GoalTime"/></param>
|
||||
public void UpdateGoal(TimeSpan? start = null)
|
||||
{
|
||||
GoalTime = (start ?? GoalTime) + Delay;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Content.Server.Fluids.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class FootstepTrackComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Server.Fluids.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Puddle on a floor
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[Access(typeof(PuddleSystem))]
|
||||
public sealed class PuddleComponent : Component
|
||||
{
|
||||
public const string DefaultSolutionName = "puddle";
|
||||
private static readonly FixedPoint2 DefaultSlipThreshold = FixedPoint2.New(-1); //Not slippery by default. Set specific slipThresholds in YAML if you want your puddles to be slippery. Lower = more slippery, and zero means any volume can slip.
|
||||
public static readonly FixedPoint2 DefaultOverflowVolume = FixedPoint2.New(20);
|
||||
|
||||
// Current design: Something calls the SpillHelper.Spill, that will either
|
||||
// A) Add to an existing puddle at the location (normalised to tile-center) or
|
||||
// B) add a new one
|
||||
// From this every time a puddle is spilt on it will try and overflow to its neighbours if possible,
|
||||
// and also update its appearance based on volume level (opacity) and chemistry color
|
||||
// Small puddles will evaporate after a set delay
|
||||
|
||||
// TODO: 'leaves fluidtracks', probably in a separate component for stuff like gibb chunks?;
|
||||
|
||||
// based on behaviour (e.g. someone being punched vs slashed with a sword would have different blood sprite)
|
||||
// to check for low volumes for evaporation or whatever
|
||||
|
||||
/// <summary>
|
||||
/// Puddles with volume above this threshold can slip players.
|
||||
/// </summary>
|
||||
[DataField("slipThreshold")]
|
||||
public FixedPoint2 SlipThreshold = DefaultSlipThreshold;
|
||||
|
||||
[DataField("spillSound")]
|
||||
public SoundSpecifier SpillSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg");
|
||||
|
||||
[DataField("overflowVolume")]
|
||||
public FixedPoint2 OverflowVolume = DefaultOverflowVolume;
|
||||
|
||||
/// <summary>
|
||||
/// How much should this puddle's opacity be multiplied by?
|
||||
/// Useful for puddles that have a high overflow volume but still want to be mostly opaque.
|
||||
/// </summary>
|
||||
[DataField("opacityModifier")] public float OpacityModifier = 1.0f;
|
||||
|
||||
[DataField("solution")] public string SolutionName { get; set; } = DefaultSolutionName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user