Files
tbd-station-14/Content.Server/Fluids/Components/PuddleComponent.cs
Willhelm53 a1dcc500a8 Puddle Visuals: ECS/Refactor and fixes (#11941)
* Don't stop me now, cuz I'm havin' such a good time (I'm havin' a ball!)

* YEET

* No changes to intended behaviour at this point. Pretty much just a refactor + bugfixes.

* tweaks to RandomizeState, removing an error caused by setting the state after setting the RSI

* Comments cleanup and removed IsSlippery. To re-add soon for this PR.

* test

* We don't actually use this PuddleGeneric anywhere

* cheeky

* Uncheeky, and tweaks based on #8203

* Recheeky

* A small price to pay for `checks passed`

* Beauty, like ice, our footing does betray; Who can tread sure on the smooth, slippery way

* Undo Slippery Checks

* Begin smoothing. Need to fix the animation-not-playing bug again

* Cleanup

* animation bugfix

* IgnoredComponents tests fix
2022-12-19 20:40:53 -06:00

54 lines
2.4 KiB
C#

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");
[ViewVariables(VVAccess.ReadOnly)]
public FixedPoint2 CurrentVolume => EntitySystem.Get<PuddleSystem>().CurrentVolume(Owner);
[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;
}
}