Added sink (#14348)
This commit is contained in:
@@ -8,6 +8,7 @@ namespace Content.Shared.Chemistry
|
||||
Color,
|
||||
FillFraction,
|
||||
BaseOverride,
|
||||
SolutionName
|
||||
}
|
||||
|
||||
public enum SolutionContainerLayers : byte
|
||||
|
||||
@@ -89,7 +89,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
|
||||
// I feel like this is somewhat cursed, but its the only way I can think of without having to just send
|
||||
// redundant data over the network and increasing DoAfter boilerplate.
|
||||
var evType = typeof(DoAfterAttemptEvent<>).MakeGenericType(args.Event.GetType());
|
||||
doAfter.AttemptEvent = _factory.CreateInstance(evType, new object[] { doAfter, args.Event }, inject: false);
|
||||
doAfter.AttemptEvent = _factory.CreateInstance(evType, new object[] { doAfter, args.Event });
|
||||
}
|
||||
|
||||
if (args.EventTarget != null)
|
||||
|
||||
@@ -1,15 +1,31 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
namespace Content.Shared.Fluids.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
/// <summary>
|
||||
/// A Drain allows an entity to absorb liquid in a disposal goal. Drains can be filled manually (with the Empty verb)
|
||||
/// or they can absorb puddles of liquid around them when AutoDrain is set to true.
|
||||
/// When the entity also has a SolutionContainerManager attached with a solution named drainBuffer, this solution
|
||||
/// gets filled until the drain is full.
|
||||
/// When the drain is full, it can be unclogged using a plunger (i.e. an entity with a Plunger tag attached).
|
||||
/// Later this can be refactored into a proper Plunger component if needed.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(SharedDrainSystem))]
|
||||
public sealed class DrainComponent : Component
|
||||
{
|
||||
public const string SolutionName = "drainBuffer";
|
||||
public const string PlungerTag = "Plunger";
|
||||
|
||||
[DataField("accumulator")]
|
||||
public float Accumulator = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// Does this drain automatically absorb surrouding puddles? Or is it a drain designed to empty
|
||||
/// solutions in it manually?
|
||||
/// </summary>
|
||||
[DataField("autoDrain"), ViewVariables(VVAccess.ReadOnly)]
|
||||
public bool AutoDrain = true;
|
||||
|
||||
/// <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.
|
||||
@@ -28,7 +44,7 @@ public sealed class DrainComponent : Component
|
||||
/// How many (unobstructed) tiles away the drain will
|
||||
/// drain puddles from.
|
||||
/// </summary>
|
||||
[DataField("range")]
|
||||
[DataField("range"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Range = 2f;
|
||||
|
||||
/// <summary>
|
||||
@@ -37,4 +53,25 @@ public sealed class DrainComponent : Component
|
||||
/// </summary>
|
||||
[DataField("drainFrequency")]
|
||||
public float DrainFrequency = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// How much time it takes to unclog it with a plunger
|
||||
/// </summary>
|
||||
[DataField("unclogDuration"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float UnclogDuration = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// What's the probability of uncloging on each try
|
||||
/// </summary>
|
||||
[DataField("unclogProbability"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float UnclogProbability = 0.3f;
|
||||
|
||||
[DataField("manualDrainSound"), ViewVariables(VVAccess.ReadOnly)]
|
||||
public SoundSpecifier ManualDrainSound = new SoundPathSpecifier("/Audio/Effects/Fluids/slosh.ogg");
|
||||
|
||||
[DataField("plungerSound"), ViewVariables(VVAccess.ReadOnly)]
|
||||
public SoundSpecifier PlungerSound = new SoundPathSpecifier("/Audio/Items/Janitor/plunger.ogg");
|
||||
|
||||
[DataField("unclogSound"), ViewVariables(VVAccess.ReadOnly)]
|
||||
public SoundSpecifier UnclogSound = new SoundPathSpecifier("/Audio/Effects/Fluids/glug.ogg");
|
||||
}
|
||||
|
||||
12
Content.Shared/Fluids/SharedDrainSystem.cs
Normal file
12
Content.Shared/Fluids/SharedDrainSystem.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Content.Shared.DoAfter;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Fluids;
|
||||
|
||||
public class SharedDrainSystem : EntitySystem
|
||||
{
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class DrainDoAfterEvent : SimpleDoAfterEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user