Update content vectors to numerics (#17759)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -134,18 +135,18 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
private Vector2 GetFinalDropCoordinates(EntityUid user, MapCoordinates origin, MapCoordinates target)
|
||||
{
|
||||
var dropVector = target.Position - origin.Position;
|
||||
var requestedDropDistance = dropVector.Length;
|
||||
var requestedDropDistance = dropVector.Length();
|
||||
|
||||
if (dropVector.Length > SharedInteractionSystem.InteractionRange)
|
||||
if (dropVector.Length() > SharedInteractionSystem.InteractionRange)
|
||||
{
|
||||
dropVector = dropVector.Normalized * SharedInteractionSystem.InteractionRange;
|
||||
dropVector = dropVector.Normalized() * SharedInteractionSystem.InteractionRange;
|
||||
target = new MapCoordinates(origin.Position + dropVector, target.MapId);
|
||||
}
|
||||
|
||||
var dropLength = _interactionSystem.UnobstructedDistance(origin, target, predicate: e => e == user);
|
||||
|
||||
if (dropLength < requestedDropDistance)
|
||||
return origin.Position + dropVector.Normalized * dropLength;
|
||||
return origin.Position + dropVector.Normalized() * dropLength;
|
||||
return target.Position;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user