Files
tbd-station-14/Content.Shared/Strip/Components/SharedStrippingComponent.cs
2021-12-03 14:17:01 +01:00

28 lines
837 B
C#

using Content.Shared.DragDrop;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Shared.Strip.Components
{
/// <summary>
/// Give to an entity to say they can strip another entity.
/// </summary>
[RegisterComponent]
public class SharedStrippingComponent : Component, IDragDropOn
{
public override string Name => "Stripping";
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Dragged.Uid, out SharedStrippableComponent? strippable)) return false;
return strippable.CanBeStripped(Owner);
}
bool IDragDropOn.DragDropOn(DragDropEvent eventArgs)
{
// Handled by StrippableComponent
return true;
}
}
}