* Update RobustToolbox * Transition direct type usages * More updates * Fix invalid use of to map * Update RobustToolbox * Fix dropping items * Rename name usages of "GridCoordinates" to "EntityCoordinates" * Revert "Update RobustToolbox" This reverts commit 9f334a17c5908ded0043a63158bb671e4aa3f346. * Revert "Update RobustToolbox" This reverts commit 3a9c8cfa3606fa501aa84407796d2ad920853a09. # Conflicts: # RobustToolbox * Fix cursed IMapGrid method usage. * GridTileLookupTest now uses EntityCoordinates Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
49 lines
2.0 KiB
C#
49 lines
2.0 KiB
C#
using Content.Server.GameObjects.Components.Chemistry;
|
|
using Content.Shared.Chemistry;
|
|
using Content.Shared.GameObjects.EntitySystems;
|
|
using Content.Shared.GameObjects.Verbs;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.Localization;
|
|
|
|
namespace Content.Server.GameObjects.Components.Fluids
|
|
{
|
|
[RegisterComponent]
|
|
public class CanSpillComponent : Component
|
|
{
|
|
public override string Name => "CanSpill";
|
|
// TODO: If the Owner doesn't have a SolutionComponent straight up just have this remove itself?
|
|
|
|
/// <summary>
|
|
/// Transfers solution from the held container to the target container.
|
|
/// </summary>
|
|
[Verb]
|
|
private sealed class FillTargetVerb : Verb<CanSpillComponent>
|
|
{
|
|
protected override void GetData(IEntity user, CanSpillComponent component, VerbData data)
|
|
{
|
|
if (!ActionBlockerSystem.CanInteract(user) ||
|
|
!component.Owner.TryGetComponent(out SolutionComponent solutionComponent))
|
|
{
|
|
data.Visibility = VerbVisibility.Invisible;
|
|
return;
|
|
}
|
|
|
|
data.Text = Loc.GetString("Spill liquid");
|
|
data.Visibility = solutionComponent.CurrentVolume > ReagentUnit.Zero
|
|
? VerbVisibility.Visible
|
|
: VerbVisibility.Disabled;
|
|
}
|
|
|
|
protected override void Activate(IEntity user, CanSpillComponent component)
|
|
{
|
|
var solutionComponent = component.Owner.GetComponent<SolutionComponent>();
|
|
// Need this as when we split the component's owner may be deleted
|
|
var entityLocation = component.Owner.Transform.Coordinates;
|
|
var solution = solutionComponent.SplitSolution(solutionComponent.CurrentVolume);
|
|
solution.SpillAt(entityLocation, "PuddleSmear");
|
|
}
|
|
}
|
|
}
|
|
}
|