2020-07-06 14:27:03 -07:00
|
|
|
using JetBrains.Annotations;
|
2022-12-10 12:05:39 -05:00
|
|
|
using Robust.Shared.Map;
|
2020-07-06 14:27:03 -07:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Interaction
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
}
|
2022-08-13 09:49:41 -04:00
|
|
|
|
2023-09-10 07:20:27 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Raised on the user before interacting on an entity with bare hand.
|
|
|
|
|
/// Interaction is cancelled if this event is handled, so set it to true if you do custom interaction logic.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class BeforeInteractHandEvent : HandledEntityEventArgs
|
|
|
|
|
{
|
|
|
|
|
public EntityUid Target { get; }
|
|
|
|
|
|
|
|
|
|
public BeforeInteractHandEvent(EntityUid target)
|
|
|
|
|
{
|
|
|
|
|
Target = target;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-10 12:05:39 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Low-level interaction event used for entities without hands.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// SHIT IS CURSED.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
//TODO: KILLLLLLL
|
|
|
|
|
public sealed class InteractNoHandEvent : HandledEntityEventArgs
|
2022-08-13 09:49:41 -04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Entity that triggered the interaction.
|
|
|
|
|
/// </summary>
|
2022-12-10 12:05:39 -05:00
|
|
|
public EntityUid User;
|
2022-08-13 09:49:41 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Entity that was interacted on.
|
|
|
|
|
/// </summary>
|
2022-12-10 12:05:39 -05:00
|
|
|
public EntityUid? Target;
|
2022-08-13 09:49:41 -04:00
|
|
|
|
2022-12-10 12:05:39 -05:00
|
|
|
public EntityCoordinates ClickLocation;
|
|
|
|
|
|
|
|
|
|
public InteractNoHandEvent(EntityUid user, EntityUid? target, EntityCoordinates clickLocation)
|
2022-08-13 09:49:41 -04:00
|
|
|
{
|
|
|
|
|
User = user;
|
|
|
|
|
Target = target;
|
2022-12-10 12:05:39 -05:00
|
|
|
ClickLocation = clickLocation;
|
2022-08-13 09:49:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
2022-11-03 23:16:23 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reverse of the InteractNoHandEvent - raised on what was interacted on, rather than the other way around.
|
|
|
|
|
/// </summary>
|
2022-12-10 12:05:39 -05:00
|
|
|
public sealed class InteractedNoHandEvent : HandledEntityEventArgs
|
2022-11-03 23:16:23 -04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Entity that was interacted on
|
|
|
|
|
/// </summary>
|
2022-12-10 12:05:39 -05:00
|
|
|
public EntityUid Target;
|
2022-11-03 23:16:23 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Entity that triggered this interaction
|
|
|
|
|
/// </summary>
|
2022-12-10 12:05:39 -05:00
|
|
|
public EntityUid User;
|
|
|
|
|
|
|
|
|
|
public EntityCoordinates ClickLocation;
|
2022-11-03 23:16:23 -04:00
|
|
|
|
2022-12-10 12:05:39 -05:00
|
|
|
public InteractedNoHandEvent(EntityUid target, EntityUid user, EntityCoordinates clickLocation)
|
2022-11-03 23:16:23 -04:00
|
|
|
{
|
|
|
|
|
Target = target;
|
|
|
|
|
User = user;
|
2022-12-10 12:05:39 -05:00
|
|
|
ClickLocation = clickLocation;
|
2022-11-03 23:16:23 -04:00
|
|
|
}
|
|
|
|
|
}
|
2020-07-06 14:27:03 -07:00
|
|
|
}
|