Improve InteractionSystem range & BUI checks (#27999)

* Improve InteractionSystem range & BUI checks

* Ghost fixes

* AAA

* Fix test

* fix nullable

* revert to broadcast event

* Fixes for eengine PR

* Ah buckle code

* )
This commit is contained in:
Leon Friedrich
2024-05-24 17:03:03 +12:00
committed by GitHub
parent 01e7c9c37e
commit 76e13eed35
18 changed files with 232 additions and 248 deletions

View File

@@ -4,6 +4,7 @@ using Content.Shared.Humanoid.Markings;
using Content.Shared.Interaction;
using Content.Shared.UserInterface;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
namespace Content.Shared.MagicMirror;
@@ -21,10 +22,13 @@ public abstract class SharedMagicMirrorSystem : EntitySystem
private void OnMirrorRangeCheck(EntityUid uid, MagicMirrorComponent component, ref BoundUserInterfaceCheckRangeEvent args)
{
if (!Exists(component.Target) || !_interaction.InRangeUnobstructed(uid, component.Target.Value))
{
if (args.Result == BoundUserInterfaceRangeResult.Fail)
return;
DebugTools.Assert(component.Target != null && Exists(component.Target));
if (!_interaction.InRangeUnobstructed(uid, component.Target.Value))
args.Result = BoundUserInterfaceRangeResult.Fail;
}
}
private void OnBeforeUIOpen(Entity<MagicMirrorComponent> ent, ref BeforeActivatableUIOpenEvent args)