This commit is contained in:
Swept
2020-09-20 15:29:11 +00:00
committed by GitHub
parent 9c72008ece
commit 0ea8792501
22 changed files with 24 additions and 45 deletions

View File

@@ -28,7 +28,6 @@ namespace Content.Server.GameObjects.EntitySystems
[UsedImplicitly]
internal sealed class HandsSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons
@@ -126,10 +125,10 @@ namespace Content.Server.GameObjects.EntitySystems
var entCoords = ent.Transform.Coordinates.Position;
var entToDesiredDropCoords = coords.Position - entCoords;
var targetLength = Math.Min(entToDesiredDropCoords.Length, SharedInteractionSystem.InteractionRange - 0.001f); // InteractionRange is reduced due to InRange not dealing with floating point error
var newCoords = coords.WithPosition((entToDesiredDropCoords.Normalized * targetLength) + entCoords).ToMap(_entityManager);
var newCoords = coords.WithPosition(entToDesiredDropCoords.Normalized * targetLength + entCoords).ToMap(_entityManager);
var rayLength = Get<SharedInteractionSystem>().UnobstructedDistance(ent.Transform.MapPosition, newCoords, ignoredEnt: ent);
handsComp.Drop(handsComp.ActiveHand, coords.WithPosition(entCoords + (entToDesiredDropCoords.Normalized * rayLength)));
handsComp.Drop(handsComp.ActiveHand, coords.WithPosition(entCoords + entToDesiredDropCoords.Normalized * rayLength));
return true;
}