mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
add interaction success/failure events (#32216)
* add interaction success/failure events * pro --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
parent
ba24ebfb4f
commit
8a924c84ae
3 changed files with 21 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue