From 9955856c0c63009b6a61290971f9a5d73a50f242 Mon Sep 17 00:00:00 2001 From: Regalis Date: Mon, 29 Aug 2016 18:26:24 +0300 Subject: [PATCH] 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 --- Subsurface/Source/Characters/Character.cs | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index c08951ba0..1a10d10b8 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -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() != null; } private Item FindClosestItem(Vector2 mouseSimPos, out float distance)