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:
@@ -6,6 +6,7 @@ using Content.Server.Players;
|
|||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
|
using Content.Shared.Utility;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects.Components;
|
using Robust.Server.GameObjects.Components;
|
||||||
using Robust.Server.Interfaces.Player;
|
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)
|
public bool TryPoint(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
|
||||||
@@ -100,7 +101,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InRange(coords, player.Transform.Coordinates))
|
if (!InRange(player, coords))
|
||||||
{
|
{
|
||||||
player.PopupMessage(Loc.GetString("You can't reach there!"));
|
player.PopupMessage(Loc.GetString("You can't reach there!"));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Server.GlobalVerbs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EntitySystem.Get<PointingSystem>().InRange(user.Transform.Coordinates, target.Transform.Coordinates))
|
if (!EntitySystem.Get<PointingSystem>().InRange(user, target.Transform.Coordinates))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user