Adjust interaction ordering & interaction conditions (#6387)

This commit is contained in:
Leon Friedrich
2022-02-05 15:39:01 +13:00
committed by GitHub
parent 442d7dbf8e
commit dd61fb46ea
28 changed files with 88 additions and 167 deletions

View File

@@ -25,6 +25,7 @@ namespace Content.Server.RCD.Systems
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
private readonly RcdMode[] _modes = (RcdMode[]) Enum.GetValues(typeof(RcdMode));
@@ -60,7 +61,7 @@ namespace Content.Server.RCD.Systems
private async void OnAfterInteract(EntityUid uid, RCDComponent rcd, AfterInteractEvent args)
{
if (args.Handled)
if (args.Handled || !args.CanReach)
return;
// FIXME: Make this work properly. Right now it relies on the click location being on a grid, which is bad.
@@ -159,7 +160,8 @@ namespace Content.Server.RCD.Systems
}
var coordinates = mapGrid.ToCoordinates(tile.GridIndices);
if (coordinates == EntityCoordinates.Invalid || !eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
if (coordinates == EntityCoordinates.Invalid ||
!_interactionSystem.InRangeUnobstructed(eventArgs.User, coordinates, ignoreInsideBlocker: true, popup: true))
{
return false;
}