Files
tbd-station-14/Content.Shared/Interfaces/GameObjects/Components/Interaction/IInteractHand.cs
ShadowCommander 6870b88a56 Interaction clean up (#4091)
* Rename and clean up interaction events

* Fix hand equip events

* Refactor duplicate client input validation

* Rename Use handler

* Move unneeded InRangeUnobstructed methods to extensions only

* Clean up UseInteractions

* Clean up ActivateItemInWorld

* Replace explicit range check with InRangeUnobstructed

Remove TransformComponent check, since transform is guaranteed now.

* Revert transform check removal

* More cleanup

* Reorder interaction checks

* Rename attack eventargs to interact

* Test V1

* Add interaction test

* Fix interaction test

* Fix container interaction test

* Rename interaction methods

* Rename player to user and attacked to target

* Clean up InteractAfter

* Clean up InRangeUnobstructed usages

* Rename attack to interact and weapon to used

* Changed can't reach message to only play when holding something

Cleaned up bracket formatting

* Fix Airtight validation check

* Remove extra words in comments

* Fix FaceClick rotation

* Move duplicate map check and face to method

* Fix test
2021-06-07 05:49:43 -07:00

57 lines
1.7 KiB
C#

using System;
using JetBrains.Annotations;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
namespace Content.Shared.Interfaces.GameObjects.Components
{
/// <summary>
/// This interface gives components behavior when being clicked on by a user with an empty hand
/// who is in range and has unobstructed reach of the target entity (allows inside blockers).
/// </summary>
[RequiresExplicitImplementation]
public interface IInteractHand
{
/// <summary>
/// Called when a player directly interacts with an empty hand when user is in range of the target entity.
/// </summary>
[Obsolete("Use AttackHandMessage instead")]
bool InteractHand(InteractHandEventArgs eventArgs);
}
public class InteractHandEventArgs : EventArgs, ITargetedInteractEventArgs
{
public InteractHandEventArgs(IEntity user, IEntity target)
{
User = user;
Target = target;
}
public IEntity User { get; }
public IEntity Target { get; }
}
/// <summary>
/// Raised when a target entity is interacted with by a user with an empty hand.
/// </summary>
[PublicAPI]
public class InteractHandEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that triggered the interaction.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that was interacted on.
/// </summary>
public IEntity Target { get; }
public InteractHandEvent(IEntity user, IEntity target)
{
User = user;
Target = target;
}
}
}