add interaction success/failure events (#32216)
* add interaction success/failure events * pro --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace Content.Shared.Interaction.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Raised on the target when failing to pet/hug something.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public readonly record struct InteractionFailureEvent(EntityUid User);
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Content.Shared.Interaction.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Raised on the target when successfully petting/hugging something.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public readonly record struct InteractionSuccessEvent(EntityUid User);
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Shared.Bed.Sleep;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Popups;
|
||||
@@ -100,6 +101,9 @@ public sealed class InteractionPopupSystem : EntitySystem
|
||||
|
||||
if (component.InteractSuccessSpawn != null)
|
||||
Spawn(component.InteractSuccessSpawn, _transform.GetMapCoordinates(uid));
|
||||
|
||||
var ev = new InteractionSuccessEvent(user);
|
||||
RaiseLocalEvent(target, ref ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -111,6 +115,9 @@ public sealed class InteractionPopupSystem : EntitySystem
|
||||
|
||||
if (component.InteractFailureSpawn != null)
|
||||
Spawn(component.InteractFailureSpawn, _transform.GetMapCoordinates(uid));
|
||||
|
||||
var ev = new InteractionFailureEvent(user);
|
||||
RaiseLocalEvent(target, ref ev);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(component.MessagePerceivedByOthers))
|
||||
|
||||
Reference in New Issue
Block a user