Item interaction distance checks

Another anti-hack measure, hopefully this stops them from wrecking the sub instantly
This commit is contained in:
juanjp600
2016-08-28 18:35:38 -03:00
parent 6c03b2ed3e
commit 6e67c86fb6

View File

@@ -865,6 +865,14 @@ namespace Barotrauma
return owner.isDead || owner.IsUnconscious || owner.Stun > 0.0f || owner.LockHands;
}
if (inventory.Owner is Item)
{
var owner = (Item)inventory.Owner;
if (Vector2.Distance(SimPosition, owner.SimPosition) > owner.PickDistance * 0.01f)
{
return false;
}
}
return true;
}
@@ -872,9 +880,17 @@ namespace Barotrauma
{
if (item.ParentInventory != null)
{
if (!CanAccessInventory(item.ParentInventory)) return false;
if (!CanAccessInventory(item.ParentInventory))
{
return false;
}
return true;
}
if (Vector2.Distance(SimPosition, item.SimPosition) > item.PickDistance * 0.01f)
{
return false;
}
return true;
}