Files
tbd-station-14/Content.Server/Fluids/EntitySystems/SpillableSystem.cs
Clyybber 0e98c1c524 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>
2021-11-23 16:38:39 -07:00

34 lines
1.1 KiB
C#

using Content.Server.Chemistry.EntitySystems;
using Content.Server.Construction.Components;
using Content.Server.Fluids.Components;
using Content.Shared.Examine;
using Content.Shared.Throwing;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.Fluids.EntitySystems;
[UsedImplicitly]
public class SpillableSystem : EntitySystem
{
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SpillableComponent, LandEvent>(SpillOnLand);
}
void SpillOnLand(EntityUid uid, SpillableComponent component, LandEvent args) {
if (args.User != null && _solutionContainerSystem.TryGetSolution(uid, component.SolutionName, out var solutionComponent))
{
_solutionContainerSystem
.Drain(uid, solutionComponent, solutionComponent.DrainAvailable)
.SpillAt(EntityManager.GetComponent<TransformComponent>(uid).Coordinates, "PuddleSmear");
}
}
}