diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 353e0f46ead..b413d27fc98 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -627,6 +627,7 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl sleep(max(sleeptime, 15)) del(animation) + //Will return the contents of an atom recursivly to a depth of 'searchDepth' /atom/proc/GetAllContents(searchDepth = 5) var/list/toReturn = list() @@ -638,6 +639,17 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl return toReturn + +/atom/proc/GetTypeInAllContents(typepath, searchDepth = 5) + for(var/atom/part in contents) + if(istype(part, typepath)) + return 1 + if(part.contents.len && searchDepth) + if(part.GetTypeInAllContents(typepath, searchDepth - 1)) + return 1 + return 0 + + //Step-towards method of determining whether one atom can see another. Similar to viewers() /proc/can_see(var/atom/source, var/atom/target, var/length=5) // I couldnt be arsed to do actual raycasting :I This is horribly inaccurate. var/turf/current = get_turf(source) diff --git a/code/modules/surgery/cavity_implant.dm b/code/modules/surgery/cavity_implant.dm index eb68242c9e0..cafa02c0cc1 100644 --- a/code/modules/surgery/cavity_implant.dm +++ b/code/modules/surgery/cavity_implant.dm @@ -24,7 +24,7 @@ /datum/surgery_step/handle_cavity/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery) if(tool) - if(IC || tool.w_class > 3 || istype(tool, /obj/item/weapon/disk/nuclear) || istype(tool, /obj/item/organ)) + if(IC || tool.w_class > 3 || tool.GetTypeInAllContents(/obj/item/weapon/disk/nuclear) || istype(tool, /obj/item/organ)) user.visible_message("[user] can't seem to fit [tool] in [target]'s [target_zone].") return 0 else