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;
|
|
|
|
|
|
|
2020-07-18 22:51:56 -07:00
|
|
|
|
namespace Content.Shared.Interfaces.GameObjects.Components
|
2020-07-06 14:27:03 -07:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2020-12-13 14:28:20 -08:00
|
|
|
|
/// This interface gives components behavior when using the entity in your active hand
|
|
|
|
|
|
/// (done by clicking the entity in the active hand or pressing the keybind that defaults to Z).
|
2020-07-06 14:27:03 -07:00
|
|
|
|
/// </summary>
|
2021-01-23 20:00:29 +01:00
|
|
|
|
[RequiresExplicitImplementation]
|
2020-07-06 14:27:03 -07:00
|
|
|
|
public interface IUse
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Called when we activate an object we are holding to use it
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
bool UseEntity(UseEntityEventArgs eventArgs);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class UseEntityEventArgs : EventArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
public IEntity User { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Raised when using the entity in your hands.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[PublicAPI]
|
|
|
|
|
|
public class UseInHandMessage : EntitySystemMessage
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// If this message has already been "handled" by a previous system.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool Handled { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Entity holding the item in their hand.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public IEntity User { get; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Item that was used.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public IEntity Used { get; }
|
|
|
|
|
|
|
|
|
|
|
|
public UseInHandMessage(IEntity user, IEntity used)
|
|
|
|
|
|
{
|
|
|
|
|
|
User = user;
|
|
|
|
|
|
Used = used;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|