diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index a261504b8c9..48d40615989 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -35,7 +35,7 @@ END TEMPLATE-->
### Breaking changes
-*None yet*
+* `BoundUserInterfaceMessageAttempt` is now a by-ref struct. It can no longer be assigned to `CancellableEntityEventArgs`.
### New features
diff --git a/Robust.Shared/GameObjects/Components/UserInterface/UserInterfaceComponent.cs b/Robust.Shared/GameObjects/Components/UserInterface/UserInterfaceComponent.cs
index df823bd550f..7a739bffd0c 100644
--- a/Robust.Shared/GameObjects/Components/UserInterface/UserInterfaceComponent.cs
+++ b/Robust.Shared/GameObjects/Components/UserInterface/UserInterfaceComponent.cs
@@ -144,20 +144,23 @@ public InterfaceData(InterfaceData data)
}
///
- /// Raised whenever the server receives a BUI message from a client relating to a UI that requires input
- /// validation.
+ /// Raised whenever the server receives a BUI message from a client relating to a UI that requires input validation.
+ /// This is first broadcast then, if not cancelled already, raised directly on the BUI's owner.
///
- public sealed class BoundUserInterfaceMessageAttempt(
- EntityUid actor,
- EntityUid target,
- Enum uiKey,
- BoundUserInterfaceMessage message)
- : CancellableEntityEventArgs
+ [ByRefEvent]
+ public record struct BoundUserInterfaceMessageAttempt(EntityUid Actor, EntityUid Target, Enum UiKey, BoundUserInterfaceMessage Message)
{
- public readonly EntityUid Actor = actor;
- public readonly EntityUid Target = target;
- public readonly Enum UiKey = uiKey;
- public readonly BoundUserInterfaceMessage Message = message;
+ public bool Cancelled { get; private set; }
+
+ public void Cancel()
+ {
+ Cancelled = true;
+ }
+
+ public void Uncancel()
+ {
+ Cancelled = false;
+ }
}
///
diff --git a/Robust.Shared/GameObjects/Systems/SharedUserInterfaceSystem.cs b/Robust.Shared/GameObjects/Systems/SharedUserInterfaceSystem.cs
index d1a4d829669..95e89e59ecc 100644
--- a/Robust.Shared/GameObjects/Systems/SharedUserInterfaceSystem.cs
+++ b/Robust.Shared/GameObjects/Systems/SharedUserInterfaceSystem.cs
@@ -123,11 +123,11 @@ private void OnMessageReceived(BoundUIWrapMessage msg, EntityUid sender)
{
var attempt = new BoundUserInterfaceMessageAttempt(sender, uid, msg.UiKey, msg.Message);
- RaiseLocalEvent(attempt);
+ RaiseLocalEvent(ref attempt);
if (attempt.Cancelled)
return;
- RaiseLocalEvent(uid, attempt);
+ RaiseLocalEvent(uid, ref attempt);
if (attempt.Cancelled)
return;
}