ninja 2 electric boogaloo (#15534)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -38,6 +38,20 @@ namespace Content.Shared.Interaction
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised on the user before interacting on an entity with bare hand.
|
||||
/// Interaction is cancelled if this event is handled, so set it to true if you do custom interaction logic.
|
||||
/// </summary>
|
||||
public sealed class BeforeInteractHandEvent : HandledEntityEventArgs
|
||||
{
|
||||
public EntityUid Target { get; }
|
||||
|
||||
public BeforeInteractHandEvent(EntityUid target)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Low-level interaction event used for entities without hands.
|
||||
/// </summary>
|
||||
|
||||
@@ -380,6 +380,15 @@ namespace Content.Shared.Interaction
|
||||
|
||||
public void InteractHand(EntityUid user, EntityUid target)
|
||||
{
|
||||
// allow for special logic before main interaction
|
||||
var ev = new BeforeInteractHandEvent(target);
|
||||
RaiseLocalEvent(user, ev);
|
||||
if (ev.Handled)
|
||||
{
|
||||
_adminLogger.Add(LogType.InteractHand, LogImpact.Low, $"{ToPrettyString(user):user} interacted with {ToPrettyString(target):target}, but it was handled by another system");
|
||||
return;
|
||||
}
|
||||
|
||||
// all interactions should only happen when in range / unobstructed, so no range check is needed
|
||||
var message = new InteractHandEvent(user, target);
|
||||
RaiseLocalEvent(target, message, true);
|
||||
|
||||
Reference in New Issue
Block a user