Tweaked the item interaction distance checks a bit:

- using worldposition instead of simposition (an item outside the airlock can be close enough to pick up even if it's far away in physics sim coordinates)
- checking if the player is inside the interact trigger of the item
- better way of checking if the item is a ladder
This commit is contained in:
Regalis
2016-08-29 18:26:24 +03:00
parent 0b2a5d5771
commit 9955856c0c
+12 -13
View File
@@ -879,24 +879,23 @@ namespace Barotrauma
public bool CanAccessItem(Item item)
{
if (item.ParentInventory != null)
{
if (!CanAccessInventory(item.ParentInventory))
{
return false;
}
return true;
{
return CanAccessInventory(item.ParentInventory);
}
float maxDist = item.PickDistance;
if (maxDist<=0.01f)
float maxDist = item.PickDistance * 1.2f;
if (maxDist <= 0.01f)
{
maxDist = 150.0f;
}
if (Vector2.Distance(SimPosition, item.SimPosition) > maxDist * 0.01f && item.ConfigFile.ToLower().IndexOf("ladder.xml")<0)
}
if (Vector2.Distance(WorldPosition, item.WorldPosition) < maxDist ||
item.IsInsideTrigger(WorldPosition))
{
return false;
}
return true;
return true;
}
return item.GetComponent<Items.Components.Ladder>() != null;
}
private Item FindClosestItem(Vector2 mouseSimPos, out float distance)