Make bound-UI range checks consistent with interaction. (#19461)
This commit is contained in:
committed by
GitHub
parent
3e93e963b5
commit
3a7274771e
@@ -34,6 +34,8 @@ namespace Content.Server.Interaction
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeNetworkEvent<DragDropRequestEvent>(HandleDragDropRequestEvent);
|
SubscribeNetworkEvent<DragDropRequestEvent>(HandleDragDropRequestEvent);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<BoundUserInterfaceCheckRangeEvent>(HandleUserInterfaceRangeCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanAccessViaStorage(EntityUid user, EntityUid target)
|
public override bool CanAccessViaStorage(EntityUid user, EntityUid target)
|
||||||
@@ -91,5 +93,20 @@ namespace Content.Server.Interaction
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void HandleUserInterfaceRangeCheck(ref BoundUserInterfaceCheckRangeEvent ev)
|
||||||
|
{
|
||||||
|
if (ev.Player.AttachedEntity is not { } user)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (InRangeUnobstructed(user, ev.Target, ev.UserInterface.InteractionRange))
|
||||||
|
{
|
||||||
|
ev.Result = BoundUserInterfaceRangeResult.Pass;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ev.Result = BoundUserInterfaceRangeResult.Fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user