Clamp out of range item drops (#631)

This commit is contained in:
Markus W. Halvorsen
2020-02-08 15:32:21 +01:00
committed by GitHub
parent d1c5cf9607
commit 595ffb3237

View File

@@ -1,4 +1,4 @@
using System;
using System;
using Content.Server.GameObjects.Components;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.Interfaces.GameObjects;
@@ -130,7 +130,11 @@ namespace Content.Server.GameObjects.EntitySystems
}
else
{
handsComp.Drop(handsComp.ActiveIndex);
var entCoords = ent.Transform.GridPosition.Position;
var entToDesiredDropCoords = coords.Position - entCoords;
var clampedDropCoords = ((entToDesiredDropCoords.Normalized * InteractionSystem.InteractionRange) + entCoords);
handsComp.Drop(handsComp.ActiveIndex, new GridCoordinates(clampedDropCoords, coords.GridID));
}
return true;