Spill hand contents when dropping them in a fall (#3304)
* Spill hand contents when dropping them due to falling down * Better approach * cleanup * grammar * stupid
This commit is contained in:
@@ -3,13 +3,14 @@ using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Content.Shared.GameObjects.Verbs;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Fluids
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class SpillableComponent : Component
|
||||
public class SpillableComponent : Component, IDropped
|
||||
{
|
||||
public override string Name => "Spillable";
|
||||
|
||||
@@ -51,11 +52,17 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
}
|
||||
|
||||
// Need this as when we split the component's owner may be deleted
|
||||
var entityLocation = component.Owner.Transform.Coordinates;
|
||||
var solution = solutionComponent.Drain(solutionComponent.DrainAvailable);
|
||||
solution.SpillAt(entityLocation, "PuddleSmear");
|
||||
solutionComponent.Drain(solutionComponent.DrainAvailable).SpillAt(component.Owner.Transform.Coordinates, "PuddleSmear");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.Intentional && Owner.TryGetComponent(out ISolutionInteractionsComponent solutionComponent))
|
||||
{
|
||||
solutionComponent.Drain(solutionComponent.DrainAvailable).SpillAt(Owner.Transform.Coordinates, "PuddleSmear");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user