2021-03-09 11:22:48 -08:00
|
|
|
using System;
|
2020-07-06 14:27:03 -07:00
|
|
|
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;
|
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
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 object
|
|
|
|
|
/// outside the range of direct use
|
|
|
|
|
/// </summary>
|
2021-01-23 20:00:29 +01:00
|
|
|
[RequiresExplicitImplementation]
|
2020-07-06 14:27:03 -07:00
|
|
|
public interface IRangedInteract
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Called when we try to interact with an entity out of range
|
|
|
|
|
/// </summary>
|
2021-04-29 03:23:15 +10:00
|
|
|
[Obsolete("Use RangedInteractMessage instead")]
|
2020-07-06 14:27:03 -07:00
|
|
|
bool RangedInteract(RangedInteractEventArgs eventArgs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PublicAPI]
|
|
|
|
|
public class RangedInteractEventArgs : EventArgs
|
|
|
|
|
{
|
2021-12-04 12:59:44 +01:00
|
|
|
public RangedInteractEventArgs(EntityUid user, EntityUid @using, EntityCoordinates clickLocation)
|
2021-03-15 21:55:49 +01:00
|
|
|
{
|
|
|
|
|
User = user;
|
|
|
|
|
Using = @using;
|
|
|
|
|
ClickLocation = clickLocation;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-04 12:59:44 +01:00
|
|
|
public EntityUid User { get; }
|
|
|
|
|
public EntityUid Using { get; }
|
2021-03-15 21:55:49 +01:00
|
|
|
public EntityCoordinates ClickLocation { get; }
|
2020-07-06 14:27:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-05-22 21:06:40 -07:00
|
|
|
/// Raised when an entity is interacted with that is out of the user entity's range of direct use.
|
2020-07-06 14:27:03 -07:00
|
|
|
/// </summary>
|
|
|
|
|
[PublicAPI]
|
2021-05-22 21:06:40 -07:00
|
|
|
public class RangedInteractEvent : 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-11-09 15:05:04 +01:00
|
|
|
public EntityUid UserUid { 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-11-09 15:05:04 +01:00
|
|
|
public EntityUid UsedUid { get; }
|
2021-11-09 15:00:59 +01:00
|
|
|
|
2020-07-06 14:27:03 -07:00
|
|
|
/// <summary>
|
2021-05-22 21:06:40 -07:00
|
|
|
/// Entity that was interacted on.
|
2020-07-06 14:27:03 -07:00
|
|
|
/// </summary>
|
2021-11-09 15:05:04 +01:00
|
|
|
public EntityUid TargetUid { 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
|
|
|
|
2021-11-09 15:05:04 +01:00
|
|
|
public RangedInteractEvent(EntityUid user, EntityUid used, EntityUid target, EntityCoordinates clickLocation)
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
2021-11-09 15:05:04 +01:00
|
|
|
UserUid = user;
|
|
|
|
|
UsedUid = used;
|
|
|
|
|
TargetUid = target;
|
2020-07-06 14:27:03 -07:00
|
|
|
ClickLocation = clickLocation;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|