2021-10-27 09:24:18 +01:00
|
|
|
using Content.Server.Fluids.EntitySystems;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2021-11-03 16:48:03 -07:00
|
|
|
using Content.Shared.FixedPoint;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2021-10-27 09:24:18 +01:00
|
|
|
using Robust.Shared.Analyzers;
|
2020-04-22 04:23:12 +10:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-04-22 04:23:12 +10:00
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Fluids.Components
|
2020-04-22 04:23:12 +10:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Puddle on a floor
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent]
|
2021-10-27 09:24:18 +01:00
|
|
|
[Friend(typeof(PuddleSystem))]
|
|
|
|
|
public sealed class PuddleComponent : Component
|
2020-04-22 04:23:12 +10:00
|
|
|
{
|
2021-10-27 09:24:18 +01:00
|
|
|
public const string DefaultSolutionName = "puddle";
|
2021-11-03 16:48:03 -07:00
|
|
|
private static readonly FixedPoint2 DefaultSlipThreshold = FixedPoint2.New(3);
|
|
|
|
|
public static readonly FixedPoint2 DefaultOverflowVolume = FixedPoint2.New(20);
|
2021-10-27 09:24:18 +01:00
|
|
|
|
2020-04-22 04:23:12 +10:00
|
|
|
// 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
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
|
2021-11-03 16:48:03 -07:00
|
|
|
[DataField("slipThreshold")] public FixedPoint2 SlipThreshold = DefaultSlipThreshold;
|
2021-09-06 15:49:44 +02:00
|
|
|
|
2021-10-27 09:24:18 +01:00
|
|
|
[DataField("spillSound")]
|
|
|
|
|
public SoundSpecifier SpillSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg");
|
2020-04-22 04:23:12 +10:00
|
|
|
|
2020-07-02 20:31:40 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether or not this puddle is currently overflowing onto its neighbors
|
|
|
|
|
/// </summary>
|
2021-10-27 09:24:18 +01:00
|
|
|
public bool Overflown;
|
2020-04-22 04:23:12 +10:00
|
|
|
|
2021-10-27 09:24:18 +01:00
|
|
|
[ViewVariables(VVAccess.ReadOnly)]
|
2021-12-03 15:53:09 +01:00
|
|
|
public FixedPoint2 CurrentVolume => EntitySystem.Get<PuddleSystem>().CurrentVolume(Owner);
|
2020-04-22 04:23:12 +10:00
|
|
|
|
2021-10-27 09:24:18 +01:00
|
|
|
[ViewVariables] [DataField("overflowVolume")]
|
2021-11-03 16:48:03 -07:00
|
|
|
public FixedPoint2 OverflowVolume = DefaultOverflowVolume;
|
2020-04-22 04:23:12 +10:00
|
|
|
|
2021-11-03 16:48:03 -07:00
|
|
|
public FixedPoint2 OverflowLeft => CurrentVolume - OverflowVolume;
|
2020-04-22 04:23:12 +10:00
|
|
|
|
2021-10-27 09:24:18 +01:00
|
|
|
[DataField("solution")] public string SolutionName { get; set; } = DefaultSolutionName;
|
2020-04-22 04:23:12 +10:00
|
|
|
}
|
|
|
|
|
}
|