Add unoccluded check for pointing arrows (#2253)

* Make pointing check for occlusions

* Make pointing ignore the pointer in case you are hella occluding

* Merge branch 'master' of https://github.com/space-wizards/space-station-14 into unoccluded-pointing
This commit is contained in:
DrSmugleaf
2020-11-03 11:25:31 +01:00
committed by GitHub
parent 1e9968f2e1
commit 3970e8b179
2 changed files with 5 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ using Content.Server.Players;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input;
using Content.Shared.Interfaces;
using Content.Shared.Utility;
using JetBrains.Annotations;
using Robust.Server.GameObjects.Components;
using Robust.Server.Interfaces.Player;
@@ -75,9 +76,9 @@ namespace Content.Server.GameObjects.EntitySystems
}
}
public bool InRange(EntityCoordinates from, EntityCoordinates to)
public bool InRange(IEntity pointer, EntityCoordinates coordinates)
{
return from.InRange(EntityManager, to, 15);
return pointer.InRangeUnOccluded(coordinates, 15, e => e == pointer);
}
public bool TryPoint(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
@@ -100,7 +101,7 @@ namespace Content.Server.GameObjects.EntitySystems
return false;
}
if (!InRange(coords, player.Transform.Coordinates))
if (!InRange(player, coords))
{
player.PopupMessage(Loc.GetString("You can't reach there!"));
return false;