using System;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
namespace Content.Shared.Interfaces.GameObjects.Components
{
///
/// This interface allows the component's entity to be dragged and dropped
/// by mouse onto another entity and gives it behavior when that occurs.
///
public interface IDragDrop
{
///
/// Invoked server-side when this component's entity is being dragged
/// and dropped on another before invoking .
/// Note that other drag and drop interactions may be attempted if
/// this one fails.
///
///
/// true if is valid, false otherwise.
bool CanDragDrop(DragDropEventArgs eventArgs);
///
/// Invoked server-side when this component's entity is being dragged
/// and dropped on another.
/// Note that other drag and drop interactions may be attempted if
/// this one fails.
///
///
/// true if an interaction occurred and no further interaction should
/// be processed for this drop.
///
bool DragDrop(DragDropEventArgs eventArgs);
}
public class DragDropEventArgs : EventArgs
{
///
/// Creates a new instance of .
///
/// The entity doing the drag and drop.
/// The location where is being dropped.
/// The entity that is being dragged and dropped.
/// The entity that is being dropped onto.
public DragDropEventArgs(IEntity user, EntityCoordinates dropLocation, IEntity dropped, IEntity target)
{
User = user;
DropLocation = dropLocation;
Dropped = dropped;
Target = target;
}
///
/// The entity doing the drag and drop.
///
public IEntity User { get; }
///
/// The location where is being dropped.
///
public EntityCoordinates DropLocation { get; }
///
/// The entity that is being dragged and dropped.
///
public IEntity Dropped { get; }
///
/// The entity that is being dropped onto.
///
public IEntity Target { get; }
}
}