2020-07-06 14:27:03 -07:00
|
|
|
using System;
|
|
|
|
|
using JetBrains.Annotations;
|
2021-01-23 22:45:23 +01:00
|
|
|
using Robust.Shared.Analyzers;
|
2020-07-06 14:27:03 -07:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Interaction
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This interface gives components behavior when being clicked on by a user with an empty hand
|
|
|
|
|
/// who is in range and has unobstructed reach of the target entity (allows inside blockers).
|
|
|
|
|
/// </summary>
|
2021-01-23 20:00:29 +01:00
|
|
|
[RequiresExplicitImplementation]
|
2020-07-06 14:27:03 -07:00
|
|
|
public interface IInteractHand
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Called when a player directly interacts with an empty hand when user is in range of the target entity.
|
|
|
|
|
/// </summary>
|
2021-06-08 19:10:29 -07:00
|
|
|
[Obsolete("Use InteractHandEvent instead")]
|
2020-07-06 14:27:03 -07:00
|
|
|
bool InteractHand(InteractHandEventArgs eventArgs);
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class InteractHandEventArgs : EventArgs, ITargetedInteractEventArgs
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
2021-12-04 12:47:09 +01:00
|
|
|
public InteractHandEventArgs(EntityUid user, EntityUid target)
|
2021-03-15 21:55:49 +01:00
|
|
|
{
|
|
|
|
|
User = user;
|
|
|
|
|
Target = target;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-04 12:47:09 +01:00
|
|
|
public EntityUid User { get; }
|
|
|
|
|
public EntityUid Target { get; }
|
2020-07-06 14:27:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-06-08 19:10:29 -07:00
|
|
|
/// Raised directed on a target entity when it is interacted with by a user with an empty hand.
|
2020-07-06 14:27:03 -07:00
|
|
|
/// </summary>
|
|
|
|
|
[PublicAPI]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class InteractHandEvent : HandledEntityEventArgs, ITargetedInteractEventArgs
|
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:47:09 +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 was interacted on.
|
|
|
|
|
/// </summary>
|
2021-12-04 12:47:09 +01:00
|
|
|
public EntityUid Target { get; }
|
2021-11-09 15:00:59 +01:00
|
|
|
|
2021-12-04 12:47:09 +01:00
|
|
|
public InteractHandEvent(EntityUid user, EntityUid target)
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
User = user;
|
2021-05-22 21:06:40 -07:00
|
|
|
Target = target;
|
2020-07-06 14:27:03 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|