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;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Interaction
|
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>
|
2021-04-29 03:23:15 +10:00
|
|
|
[Obsolete("Use UseInHandMessage instead")]
|
2020-07-06 14:27:03 -07:00
|
|
|
bool UseEntity(UseEntityEventArgs eventArgs);
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class UseEntityEventArgs : EventArgs
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
2021-12-04 12:35:33 +01:00
|
|
|
public UseEntityEventArgs(EntityUid user)
|
2021-03-15 21:55:49 +01:00
|
|
|
{
|
|
|
|
|
User = user;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-04 12:35:33 +01:00
|
|
|
public EntityUid User { get; }
|
2020-07-06 14:27:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Raised when using the entity in your hands.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[PublicAPI]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class UseInHandEvent : HandledEntityEventArgs
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Entity holding the item in their hand.
|
|
|
|
|
/// </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>
|
|
|
|
|
/// Item that was used.
|
|
|
|
|
/// </summary>
|
2021-12-04 12:35:33 +01:00
|
|
|
public EntityUid Used { get; }
|
2021-11-09 15:00:59 +01:00
|
|
|
|
2021-12-04 12:35:33 +01:00
|
|
|
public UseInHandEvent(EntityUid user, EntityUid used)
|
2020-07-06 14:27:03 -07:00
|
|
|
{
|
|
|
|
|
User = user;
|
|
|
|
|
Used = used;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|