Files

47 lines
1.5 KiB
C#
Raw Permalink Normal View History

using JetBrains.Annotations;
using Robust.Shared.Map;
using Robust.Shared.Utility;
2021-06-09 22:19:39 +02:00
namespace Content.Shared.Interaction
{
/// <summary>
/// Raised when a target entity is interacted with by a user while holding an object in their hand.
/// </summary>
[PublicAPI]
public sealed class InteractUsingEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that triggered the interaction.
/// </summary>
2021-12-04 12:35:33 +01:00
public EntityUid User { get; }
/// <summary>
/// Entity that the user used to interact.
/// </summary>
2021-12-04 12:35:33 +01:00
public EntityUid Used { get; }
/// <summary>
/// Entity that was interacted on.
/// </summary>
2021-12-04 12:35:33 +01:00
public EntityUid Target { get; }
/// <summary>
/// The original location that was clicked by the user.
/// </summary>
public EntityCoordinates ClickLocation { get; }
public InteractUsingEvent(EntityUid user, EntityUid used, EntityUid target, EntityCoordinates clickLocation)
{
// 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);
User = user;
Used = used;
Target = target;
ClickLocation = clickLocation;
}
}
}