Files
tbd-station-14/Content.Server/Interfaces/GameObjects/Components/Interaction/IDragDrop.cs
chairbender b35333d366 Click Drag Functionality + Refactor Interaction Interfaces (#1125)
Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
Co-authored-by: ComicIronic <comicironic@gmail.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2020-07-06 23:27:03 +02:00

41 lines
1.4 KiB
C#

using System;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
namespace Content.Server.Interfaces.GameObjects.Components.Interaction
{
/// <summary>
/// This interface allows the component's entity to be dragged and dropped by mouse onto another entity and gives it
/// behavior when that occurs.
/// </summary>
public interface IDragDrop
{
/// <summary>
/// Invoked server-side when this component's entity is being dragged and dropped on another.
///
/// There is no other server-side drag and drop check other than a range check, so make sure to validate
/// if this object can be dropped on the target object!
/// </summary>
/// <returns>true iff an interaction occurred and no further interaction should
/// be processed for this drop.</returns>
bool DragDrop(DragDropEventArgs eventArgs);
}
public class DragDropEventArgs : EventArgs
{
public DragDropEventArgs(IEntity user, GridCoordinates dropLocation, IEntity dropped, IEntity target)
{
User = user;
DropLocation = dropLocation;
Dropped = dropped;
Target = target;
}
public IEntity User { get; }
public GridCoordinates DropLocation { get; }
public IEntity Dropped { get; }
public IEntity Target { get; }
}
}