From 3970e8b179f16ea53a8c765c9061533905d187d8 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Tue, 3 Nov 2020 11:25:31 +0100 Subject: [PATCH] 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 --- Content.Server/GameObjects/EntitySystems/PointingSystem.cs | 7 ++++--- Content.Server/GlobalVerbs/PointingVerb.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/PointingSystem.cs b/Content.Server/GameObjects/EntitySystems/PointingSystem.cs index 50bfd070d2..b7d1e8e8cf 100644 --- a/Content.Server/GameObjects/EntitySystems/PointingSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PointingSystem.cs @@ -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; diff --git a/Content.Server/GlobalVerbs/PointingVerb.cs b/Content.Server/GlobalVerbs/PointingVerb.cs index c3cdef56f4..3dd52e6941 100644 --- a/Content.Server/GlobalVerbs/PointingVerb.cs +++ b/Content.Server/GlobalVerbs/PointingVerb.cs @@ -25,7 +25,7 @@ namespace Content.Server.GlobalVerbs return; } - if (!EntitySystem.Get().InRange(user.Transform.Coordinates, target.Transform.Coordinates)) + if (!EntitySystem.Get().InRange(user, target.Transform.Coordinates)) { return; }