2020-07-18 22:51:56 -07: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;
|
|
|
|
|
|
|
2020-07-18 22:51:56 -07:00
|
|
|
|
namespace Content.Shared.Interfaces.GameObjects.Components
|
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>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
bool RangedInteract(RangedInteractEventArgs eventArgs);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[PublicAPI]
|
|
|
|
|
|
public class RangedInteractEventArgs : EventArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
public IEntity User { get; set; }
|
|
|
|
|
|
public IEntity Using { get; set; }
|
2020-09-06 16:11:53 +02:00
|
|
|
|
public EntityCoordinates ClickLocation { get; set; }
|
2020-07-06 14:27:03 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Raised when being clicked by objects outside the range of direct use.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[PublicAPI]
|
|
|
|
|
|
public class RangedInteractMessage : EntitySystemMessage
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// If this message has already been "handled" by a previous system.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool Handled { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Entity that triggered the attack.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public IEntity User { get; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Entity that the User attacked with.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public IEntity ItemInHand { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Entity that was attacked.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public IEntity Attacked { get; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <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
|
|
|
|
|
2020-09-06 16:11:53 +02:00
|
|
|
|
public RangedInteractMessage(IEntity user, IEntity itemInHand, IEntity attacked, EntityCoordinates clickLocation)
|
2020-07-06 14:27:03 -07:00
|
|
|
|
{
|
|
|
|
|
|
User = user;
|
|
|
|
|
|
ItemInHand = itemInHand;
|
|
|
|
|
|
ClickLocation = clickLocation;
|
|
|
|
|
|
Attacked = attacked;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|