From: Milon Date: Fri, 11 Apr 2025 15:33:32 +0000 (+0200) Subject: Directional BoundUserInterfaceMessageAttempt content edition (#36320) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3a6441932eb5c4923231f97dd202c877b7e03664;p=space-station-14.git Directional BoundUserInterfaceMessageAttempt content edition (#36320) --- diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index ff9f41e1f9..9a2706d8a0 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -106,7 +106,7 @@ namespace Content.Shared.Interaction _uiQuery = GetEntityQuery(); SubscribeLocalEvent(HandleUserInterfaceRangeCheck); - SubscribeLocalEvent(OnBoundInterfaceInteractAttempt); + SubscribeLocalEvent(OnBoundInterfaceInteractAttempt); SubscribeAllEvent(HandleInteractInventorySlotEvent); @@ -151,13 +151,12 @@ namespace Content.Shared.Interaction /// /// Check that the user that is interacting with the BUI is capable of interacting and can access the entity. /// - private void OnBoundInterfaceInteractAttempt(BoundUserInterfaceMessageAttempt ev) + private void OnBoundInterfaceInteractAttempt(Entity ent, ref BoundUserInterfaceMessageAttempt ev) { - _uiQuery.TryComp(ev.Target, out var uiComp); if (!_actionBlockerSystem.CanInteract(ev.Actor, ev.Target)) { // We permit ghosts to open uis unless explicitly blocked - if (ev.Message is not OpenBoundInterfaceMessage || !HasComp(ev.Actor) || uiComp?.BlockSpectators == true) + if (ev.Message is not OpenBoundInterfaceMessage || !HasComp(ev.Actor) || ent.Comp.BlockSpectators) { ev.Cancel(); return; @@ -175,16 +174,14 @@ namespace Content.Shared.Interaction return; } - if (uiComp == null) - return; - if (uiComp.SingleUser && uiComp.CurrentSingleUser != null && uiComp.CurrentSingleUser != ev.Actor) + if (ent.Comp.SingleUser && ent.Comp.CurrentSingleUser != null && ent.Comp.CurrentSingleUser != ev.Actor) { ev.Cancel(); return; } - if (uiComp.RequiresComplex && !_actionBlockerSystem.CanComplexInteract(ev.Actor)) + if (ent.Comp.RequiresComplex && !_actionBlockerSystem.CanComplexInteract(ev.Actor)) ev.Cancel(); } diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs index 374d9b8cbf..4b0fbdcf4b 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs @@ -20,7 +20,7 @@ public abstract partial class SharedStationAiSystem private void InitializeHeld() { SubscribeLocalEvent(OnRadialMessage); - SubscribeLocalEvent(OnMessageAttempt); + SubscribeLocalEvent(OnMessageAttempt); SubscribeLocalEvent>(OnTargetVerbs); SubscribeLocalEvent(OnHeldInteraction); @@ -116,7 +116,7 @@ public abstract partial class SharedStationAiSystem RaiseLocalEvent(target.Value, (object) ev.Event); } - private void OnMessageAttempt(BoundUserInterfaceMessageAttempt ev) + private void OnMessageAttempt(Entity ent, ref BoundUserInterfaceMessageAttempt ev) { if (ev.Actor == ev.Target) return; diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index 9297ea043d..f2a2031743 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -142,7 +142,7 @@ public abstract class SharedStorageSystem : EntitySystem SubscribeLocalEvent(OnImplantActivate); SubscribeLocalEvent(AfterInteract); SubscribeLocalEvent(OnDestroy); - SubscribeLocalEvent(OnBoundUIAttempt); + SubscribeLocalEvent(OnBoundUIAttempt); SubscribeLocalEvent(OnBoundUIOpen); SubscribeLocalEvent(OnLockToggled); SubscribeLocalEvent(OnStackCountChanged); @@ -761,7 +761,7 @@ public abstract class SharedStorageSystem : EntitySystem UpdateAppearance((ent.Owner, ent.Comp, null)); } - private void OnBoundUIAttempt(BoundUserInterfaceMessageAttempt args) + private void OnBoundUIAttempt(Entity ent, ref BoundUserInterfaceMessageAttempt args) { if (args.UiKey is not StorageComponent.StorageUiKey.Key || _openStorageLimit == -1 ||