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:
@@ -879,24 +879,23 @@ namespace Barotrauma
|
|||||||
public bool CanAccessItem(Item item)
|
public bool CanAccessItem(Item item)
|
||||||
{
|
{
|
||||||
if (item.ParentInventory != null)
|
if (item.ParentInventory != null)
|
||||||
{
|
{
|
||||||
if (!CanAccessInventory(item.ParentInventory))
|
return CanAccessInventory(item.ParentInventory);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float maxDist = item.PickDistance;
|
float maxDist = item.PickDistance * 1.2f;
|
||||||
if (maxDist<=0.01f)
|
if (maxDist <= 0.01f)
|
||||||
{
|
{
|
||||||
maxDist = 150.0f;
|
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)
|
private Item FindClosestItem(Vector2 mouseSimPos, out float distance)
|
||||||
|
|||||||
Reference in New Issue
Block a user