Files
tbd-station-14/Content.Server/Fluids/Components/SpillableComponent.cs
Ygg01 b2aca94586 Refactor Solution from Shared -> Server (#5078)
* Move entity solution entity systems to shared

* Move SolutionComponents to Server

* Fix namespaces

* Remove Networked Component.

* Fixes

* Add components to ignore list
2021-10-29 23:40:15 +11:00

28 lines
939 B
C#

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