Files
tbd-station-14/Content.Shared/Interaction/IUse.cs
2022-02-16 18:23:23 +11:00

56 lines
1.5 KiB
C#

using System;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.Interaction
{
/// <summary>
/// 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).
/// </summary>
[RequiresExplicitImplementation]
public interface IUse
{
/// <summary>
/// Called when we activate an object we are holding to use it
/// </summary>
/// <returns></returns>
[Obsolete("Use UseInHandMessage instead")]
bool UseEntity(UseEntityEventArgs eventArgs);
}
public sealed class UseEntityEventArgs : EventArgs
{
public UseEntityEventArgs(EntityUid user)
{
User = user;
}
public EntityUid User { get; }
}
/// <summary>
/// Raised when using the entity in your hands.
/// </summary>
[PublicAPI]
public sealed class UseInHandEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity holding the item in their hand.
/// </summary>
public EntityUid User { get; }
/// <summary>
/// Item that was used.
/// </summary>
public EntityUid Used { get; }
public UseInHandEvent(EntityUid user, EntityUid used)
{
User = user;
Used = used;
}
}
}