2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.DragDrop;
|
2021-01-24 19:00:58 +11:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-03 14:17:01 +01:00
|
|
|
using Robust.Shared.IoC;
|
2021-01-24 19:00:58 +11:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Strip.Components
|
2021-01-24 19:00:58 +11:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Give to an entity to say they can strip another entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class SharedStrippingComponent : Component, IDragDropOn
|
2021-01-24 19:00:58 +11:00
|
|
|
{
|
2021-05-22 21:06:40 -07:00
|
|
|
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
|
2021-01-24 19:00:58 +11:00
|
|
|
{
|
2021-12-03 15:53:09 +01:00
|
|
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Dragged, out SharedStrippableComponent? strippable)) return false;
|
2021-01-24 19:00:58 +11:00
|
|
|
return strippable.CanBeStripped(Owner);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-22 21:06:40 -07:00
|
|
|
bool IDragDropOn.DragDropOn(DragDropEvent eventArgs)
|
2021-01-24 19:00:58 +11:00
|
|
|
{
|
|
|
|
|
// Handled by StrippableComponent
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|