From b691663e2fbb62ea864c9788a18f7547c8001002 Mon Sep 17 00:00:00 2001
From: deltanedas <@deltanedas:goida.zip>
Date: Tue, 25 Aug 2026 06:25:26 +0100
Subject: [PATCH 1/2] make BoundUserInterfaceMessageAttempt by ref struct
---
.../UserInterface/UserInterfaceComponent.cs | 27 ++++++++++---------
.../Systems/SharedUserInterfaceSystem.cs | 4 +--
2 files changed, 17 insertions(+), 14 deletions(-)
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;
}
From fc62f8b92b13075e79a5a00775c0ea0a9953f1c5 Mon Sep 17 00:00:00 2001
From: deltanedas <@deltanedas:goida.zip>
Date: Tue, 25 Aug 2026 06:25:34 +0100
Subject: [PATCH 2/2] update release notes
---
RELEASE-NOTES.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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