From b3f396bfff6850a2759848d1711d3bf5f39b3e30 Mon Sep 17 00:00:00 2001 From: VampyrBytes Date: Thu, 17 Jul 2014 05:48:59 +0100 Subject: [PATCH] Fixes inventory bug Fixes the bug where you couldn't interact with someone's inventory when they were on top of a structure, such as a table --- code/__HELPERS/unsorted.dm | 13 +++++++++++++ code/modules/mob/living/carbon/human/inventory.dm | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index febcc061e06..96246be7de5 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -224,6 +224,19 @@ Turf and target are seperate in case you want to teleport some distance from a t return 0 +// Returns true if a link is blocked and neither location has something climbable on +// Used for inventory checks +/proc/LinkBlockedUnclimbable(turf/A, turf/B) + if (!LinkBlocked(A, B)) + return 0 + for (var/obj/structure/S in A.contents) + if(S.climbable) + return 0 + for (var/obj/structure/S in B.contents) + if(S.climbable) + return 0 + return 1 + // Returns true if direction is blocked from loc // Checks if doors are open /proc/DirBlocked(turf/loc,var/dir) diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 370aa40c67f..16a724e48a9 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -607,7 +607,7 @@ It can still be worn/put on as normal. if(!source || !target) return //Target or source no longer exist if(source.loc != s_loc) return //source has moved if(target.loc != t_loc) return //target has moved - if(LinkBlocked(s_loc,t_loc)) return //Use a proxi! + if (LinkBlockedUnclimbable(t_loc, s_loc)) return if(item && source.get_active_hand() != item) return //Swapped hands / removed item from the active one if ((source.restrained() || source.stat)) return //Source restrained or unconscious / dead