Refactor InRangeUnobstructed and add extension methods (#1925)
* Sort out InRangeUnobstructed and add extension methods * Rename client RangeChecks to RangeExtensions * Add container extension methods and test * Add missing component methods Component to container Grid coordinates to container Map coordinates to container Local player to container * Actually use the field * Merge fixes * Add popup argument to local player extension methods * Reduce code repetition for client range extensions
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.Utility;
|
||||
using Robust.Client.GameObjects.EntitySystems;
|
||||
using Robust.Client.Interfaces.GameObjects;
|
||||
using Robust.Client.Interfaces.Graphics.ClientEye;
|
||||
@@ -67,13 +68,7 @@ namespace Content.Client.State
|
||||
var inRange = false;
|
||||
if (localPlayer.ControlledEntity != null && entityToClick != null)
|
||||
{
|
||||
var playerPos = localPlayer.ControlledEntity.Transform.MapPosition;
|
||||
var entityPos = entityToClick.Transform.MapPosition;
|
||||
inRange = EntitySystemManager.GetEntitySystem<SharedInteractionSystem>()
|
||||
.InRangeUnobstructed(playerPos, entityPos,
|
||||
predicate: entity =>
|
||||
entity == localPlayer.ControlledEntity || entity == entityToClick,
|
||||
ignoreInsideBlocker: true);
|
||||
inRange = localPlayer.InRangeUnobstructed(entityToClick, ignoreInsideBlocker: true);
|
||||
}
|
||||
|
||||
InteractionOutlineComponent outline;
|
||||
|
||||
Reference in New Issue
Block a user