From 4fdacf0560626b22a04b45aa9c4c8832fc0b5ca4 Mon Sep 17 00:00:00 2001 From: MrJWhit <48370570+MrJWhit@users.noreply.github.com> Date: Sat, 17 Oct 2020 05:39:25 -0400 Subject: [PATCH] Porting putnams ventcrawling PR and Fix (#13571) * Porting putnams rage * And the bugfix --- code/modules/mob/inventory.dm | 8 ++++++++ code/modules/mob/living/ventcrawling.dm | 11 ++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 9ac270bf34..9cf3f44cb8 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -100,6 +100,14 @@ return held_items.Find(I) +///Find number of held items, multihand compatible +/mob/proc/get_num_held_items() + . = 0 + for(var/i in 1 to held_items.len) + if(held_items[i]) + .++ + + //Sad that this will cause some overhead, but the alias seems necessary //*I* may be happy with a million and one references to "indexes" but others won't be /mob/proc/is_holding(obj/item/I) diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index 6661d0ccea..4c00fd0033 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -59,15 +59,8 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, typecacheof(list( if(!client) return - if(iscarbon(src) && ventcrawler < 2)//It must have atleast been 1 to get this far - var/failed = 0 - var/list/items_list = get_equipped_items(include_pockets = TRUE) - if(items_list.len) - failed = 1 - for(var/obj/item/I in held_items) - failed = 1 - break - if(failed) + if(iscarbon(src) && ventcrawler == VENTCRAWLER_NUDE) + if(length(get_equipped_items(include_pockets = TRUE)) || get_num_held_items()) to_chat(src, "You can't crawl around in the ventilation ducts with items!") return