Fixed access to items without PickDistance

The ladder check is a horrible hack, but if you're horribly desynced then trying to interact with one will just kill you :)
This commit is contained in:
juanjp600
2016-08-28 20:26:36 -03:00
parent 86704c7d83
commit d27cafffa9

View File

@@ -868,7 +868,7 @@ namespace Barotrauma
if (inventory.Owner is Item)
{
var owner = (Item)inventory.Owner;
if (Vector2.Distance(SimPosition, owner.SimPosition) > owner.PickDistance * 0.01f)
if (!CanAccessItem(owner))
{
return false;
}
@@ -885,9 +885,14 @@ namespace Barotrauma
return false;
}
return true;
}
float maxDist = item.PickDistance;
if (maxDist<=0.01f)
{
maxDist = 150.0f;
}
if (Vector2.Distance(SimPosition, item.SimPosition) > item.PickDistance * 0.01f)
if (Vector2.Distance(SimPosition, item.SimPosition) > maxDist * 0.01f && item.ConfigFile.ToLower().IndexOf("ladder.xml")<0)
{
return false;
}