2020-12-17 10:45:04 +03:00
|
|
|
using System.Threading.Tasks;
|
2020-07-06 14:27:03 -07:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
2021-01-11 09:36:21 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Interaction
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
[PublicAPI]
|
2022-02-05 15:39:01 +13:00
|
|
|
public abstract class InteractEvent : HandledEntityEventArgs
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2021-05-22 21:06:40 -07:00
|
|
|
/// Entity that triggered the interaction.
|
2020-07-06 14:27:03 -07:00
|
|
|
/// </summary>
|
2021-12-04 12:35:33 +01:00
|
|
|
public EntityUid User { get; }
|
2020-07-06 14:27:03 -07:00
|
|
|
|
2021-11-09 15:00:59 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Entity that the user used to interact.
|
|
|
|
|
/// </summary>
|
2021-12-04 12:35:33 +01:00
|
|
|
public EntityUid Used { get; }
|
2020-07-06 14:27:03 -07:00
|
|
|
|
2021-11-09 15:00:59 +01:00
|
|
|
/// <summary>
|
2022-02-05 15:39:01 +13:00
|
|
|
/// Entity that was interacted on. This can be null if there was no target (e.g., clicking on tiles).
|
2021-11-09 15:00:59 +01:00
|
|
|
/// </summary>
|
2021-12-04 12:35:33 +01:00
|
|
|
public EntityUid? Target { get; }
|
2021-11-09 15:00:59 +01:00
|
|
|
|
2020-07-06 14:27:03 -07:00
|
|
|
/// <summary>
|
|
|
|
|
/// Location that the user clicked outside of their interaction range.
|
|
|
|
|
/// </summary>
|
2020-09-06 16:11:53 +02:00
|
|
|
public EntityCoordinates ClickLocation { get; }
|
2020-07-06 14:27:03 -07:00
|
|
|
|
2020-07-10 16:52:07 -07:00
|
|
|
/// <summary>
|
2022-02-05 15:39:01 +13:00
|
|
|
/// Is the click location in range without obstructions?
|
2020-07-10 16:52:07 -07:00
|
|
|
/// </summary>
|
|
|
|
|
public bool CanReach { get; }
|
|
|
|
|
|
2022-02-05 15:39:01 +13:00
|
|
|
public InteractEvent(EntityUid user, EntityUid used, EntityUid? target,
|
2021-01-11 09:36:21 +01:00
|
|
|
EntityCoordinates clickLocation, bool canReach)
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
User = user;
|
2021-05-22 21:06:40 -07:00
|
|
|
Used = used;
|
|
|
|
|
Target = target;
|
2020-07-06 14:27:03 -07:00
|
|
|
ClickLocation = clickLocation;
|
2020-07-10 16:52:07 -07:00
|
|
|
CanReach = canReach;
|
2020-07-06 14:27:03 -07:00
|
|
|
}
|
|
|
|
|
}
|
2022-02-05 15:39:01 +13:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Raised directed on the used object when clicking on another object and no standard interaction occurred.
|
|
|
|
|
/// Used for low-priority interactions facilitated by the used entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class AfterInteractEvent : InteractEvent
|
|
|
|
|
{
|
|
|
|
|
public AfterInteractEvent(EntityUid user, EntityUid used, EntityUid? target,
|
|
|
|
|
EntityCoordinates clickLocation, bool canReach) : base(user, used, target, clickLocation, canReach)
|
|
|
|
|
{ }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Raised directed on the target when clicking on another object and no standard interaction occurred. Used for
|
|
|
|
|
/// low-priority interactions facilitated by the target entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class AfterInteractUsingEvent : InteractEvent
|
|
|
|
|
{
|
|
|
|
|
public AfterInteractUsingEvent(EntityUid user, EntityUid used, EntityUid? target,
|
|
|
|
|
EntityCoordinates clickLocation, bool canReach) : base(user, used, target, clickLocation, canReach)
|
|
|
|
|
{ }
|
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
}
|