Files
crystall-punk-14/Content.Server/Fluids/Components/SpillableComponent.cs

28 lines
939 B
C#
Raw Normal View History

using Content.Shared.Chemistry.EntitySystems;
2021-07-31 03:14:00 +02:00
using Content.Shared.Interaction;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
2021-06-09 22:19:39 +02:00
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");
}
}
}
}