2020-07-06 14:27:03 -07:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Robust.Shared.Map;
|
2022-02-23 17:58:06 +13:00
|
|
|
using Robust.Shared.Utility;
|
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
|
|
|
{
|
|
|
|
|
/// <summary>
|
2021-05-22 21:06:40 -07:00
|
|
|
/// Raised when a target entity is interacted with by a user while holding an object in their hand.
|
2020-07-06 14:27:03 -07:00
|
|
|
/// </summary>
|
|
|
|
|
[PublicAPI]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class InteractUsingEvent : 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>
|
|
|
|
|
/// Entity that was interacted on.
|
|
|
|
|
/// </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>
|
|
|
|
|
/// The original location that was clicked by the user.
|
|
|
|
|
/// </summary>
|
2020-09-06 16:11:53 +02:00
|
|
|
public EntityCoordinates ClickLocation { get; }
|
2020-07-06 14:27:03 -07:00
|
|
|
|
2022-03-31 20:08:30 +13:00
|
|
|
public InteractUsingEvent(EntityUid user, EntityUid used, EntityUid target, EntityCoordinates clickLocation)
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
2022-02-23 17:58:06 +13:00
|
|
|
// Interact using should not have the same used and target.
|
|
|
|
|
// That should be a use-in-hand event instead.
|
|
|
|
|
// If this is not the case, can lead to bugs (e.g., attempting to merge a item stack into itself).
|
|
|
|
|
DebugTools.Assert(used != target);
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|