Fluid spread refactor (#11908)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Fix undefined
This commit is contained in:
Ygg01
2022-11-15 12:30:59 +01:00
committed by GitHub
parent 89b959f931
commit 75ea093d78
17 changed files with 719 additions and 336 deletions

View File

@@ -0,0 +1,35 @@
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;
}
}