diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 25c256322ef..66998d42a31 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -34,4 +34,9 @@ #define CLICK_CD_MELEE 8 #define CLICK_CD_RANGE 4 -//click cooldowns, in tenths of a second \ No newline at end of file +//click cooldowns, in tenths of a second + + +#define BE_CLOSE 1 //in the case of a silicon, to select if they need to be next to the atom +#define NO_DEXTERY 1 //if other mobs (monkeys, aliens, etc) can use this +//used by canUseTopic() \ No newline at end of file diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index f5612c6aef8..e89140ebf3c 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -216,8 +216,12 @@ Class Procs: if(check_rights(R_ADMIN)) return -/mob/living/canUseTopic() - src << "You don't have the dexterity to do this!" +/mob/living/canUseTopic(atom/movable/M, be_close = 0, no_dextery = 0) + if(no_dextery) + if(be_close && in_range(M, src)) + return 1 + else + src << "You don't have the dexterity to do this!" return /mob/living/carbon/human/canUseTopic(atom/movable/M) @@ -229,14 +233,18 @@ Class Procs: return return 1 -/mob/living/silicon/ai/canUseTopic() +/mob/living/silicon/ai/canUseTopic(atom/movable/M, be_close = 0) if(stat) return + if(be_close && !in_range(M, src)) + return return 1 -/mob/living/silicon/robot/canUseTopic() +/mob/living/silicon/robot/canUseTopic(atom/movable/M, be_close = 0) if(stat || lockcharge || stunned || weakened) return + if(be_close && !in_range(M, src)) + return return 1 /obj/machinery/attack_ai(mob/user as mob) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index eb89d6cf49b..c5c99d24fd7 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -345,7 +345,7 @@ In all, this is a lot like the monkey code. /N /mob/living/carbon/alien/humanoid/Topic(href, href_list) ..() //strip panel - if(!usr.stat && usr.canmove && !usr.restrained() && in_range(src, usr)) + if(canUseTopic(src, BE_CLOSE, NO_DEXTERY)) if(href_list["pouches"]) visible_message("[usr] tries to empty [src]'s pouches.", \ "[usr] tries to empty [src]'s pouches.") diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index f2dfb348f29..238ea92e612 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -420,7 +420,7 @@ /mob/living/carbon/Topic(href, href_list) ..() //strip panel - if(!usr.stat && usr.canmove && !usr.restrained() && in_range(src, usr)) + if(canUseTopic(src, BE_CLOSE, NO_DEXTERY)) if(href_list["internal"]) var/slot = text2num(href_list["internal"]) var/obj/item/ITEM = get_item_by_slot(slot) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 6cdcc417ba5..7a5624ce031 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -403,7 +403,7 @@ /mob/living/carbon/human/Topic(href, href_list) - if(!usr.stat && usr.canmove && !usr.restrained() && Adjacent(usr)) + if(canUseTopic(src, BE_CLOSE, NO_DEXTERY)) if(href_list["item"]) var/slot = text2num(href_list["item"]) if(slot in check_obscured_slots()) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 5dc726708c5..f244a464ea6 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -485,7 +485,7 @@ var/list/slot_equipment_priority = list( \ if(machine && in_range(src, usr)) show_inv(machine) - if(!usr.stat && usr.canmove && !usr.restrained() && Adjacent(usr)) + if(canUseTopic(src, BE_CLOSE, NO_DEXTERY)) if(href_list["item"]) var/slot = text2num(href_list["item"]) var/obj/item/what = get_item_by_slot(slot)