Refactor slip dropping to use throwing (#5476)

* Refactor slip dropping to use throwing

* Update Content.Server/Fluids/EntitySystems/SpillableSystem.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Uncringe

* Update Content.Server/Fluids/EntitySystems/SpillableSystem.cs

Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
This commit is contained in:
Clyybber
2021-11-24 00:38:39 +01:00
committed by GitHub
parent ee27c75224
commit 0e98c1c524
10 changed files with 113 additions and 121 deletions

View File

@@ -3,25 +3,13 @@ using Content.Shared.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Fluids.Components
namespace Content.Server.Fluids.Components;
[RegisterComponent]
public class SpillableComponent : Component
{
[RegisterComponent]
public class SpillableComponent : Component, IDropped
{
public override string Name => "Spillable";
public override string Name => "Spillable";
[DataField("solution")]
public string SolutionName = "puddle";
void IDropped.Dropped(DroppedEventArgs eventArgs)
{
if (!eventArgs.Intentional
&& EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner.Uid, SolutionName, out var solutionComponent))
{
EntitySystem.Get<SolutionContainerSystem>()
.Drain(Owner.Uid, solutionComponent, solutionComponent.DrainAvailable)
.SpillAt(Owner.Transform.Coordinates, "PuddleSmear");
}
}
}
[DataField("solution")]
public string SolutionName = "puddle";
}