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:
33
Content.Server/Fluids/EntitySystems/SpillableSystem.cs
Normal file
33
Content.Server/Fluids/EntitySystems/SpillableSystem.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user