Fixed bug where the mouse highlighting was always red on an entity when the grid was offset from the map origin.

This commit is contained in:
Acruid
2020-02-04 22:28:46 -08:00
parent dfe08d1262
commit 35dc6b2eee
2 changed files with 4 additions and 6 deletions

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Client.GameObjects.Components; using Content.Client.GameObjects.Components;
using Content.Client.GameObjects.EntitySystems;
using Content.Shared.GameObjects; using Content.Shared.GameObjects;
using Robust.Client.GameObjects.EntitySystems; using Robust.Client.GameObjects.EntitySystems;
using Robust.Client.Interfaces.GameObjects; using Robust.Client.Interfaces.GameObjects;
@@ -70,10 +69,9 @@ namespace Content.Client.State
var inRange = false; var inRange = false;
if (playerManager.LocalPlayer.ControlledEntity != null && entityToClick != null) if (playerManager.LocalPlayer.ControlledEntity != null && entityToClick != null)
{ {
var playerPos = playerManager.LocalPlayer.ControlledEntity.Transform.GridPosition; var playerPos = playerManager.LocalPlayer.ControlledEntity.Transform.WorldPosition;
var entityPos = entityToClick.Transform.GridPosition; var entityPos = entityToClick.Transform.WorldPosition;
var distance = playerPos.Distance(_mapManager, entityPos); inRange = (entityPos - playerPos).Length <= VerbUtility.InteractionRange;
inRange = distance <= VerbUtility.InteractionRange;
} }
InteractionOutlineComponent outline; InteractionOutlineComponent outline;