diff --git a/code/game/objects/items/devices/dummy_tablet.dm b/code/game/objects/items/devices/dummy_tablet.dm index 92cfa4b90e26..d1036ebfa93b 100644 --- a/code/game/objects/items/devices/dummy_tablet.dm +++ b/code/game/objects/items/devices/dummy_tablet.dm @@ -12,6 +12,20 @@ linked_dummy = null . = ..() +/** + * Checks if the user is adjacent to the dummy + * + * Returns TRUE if the user is adjacent to the dummy, FALSE otherwise + * + * * arg-1: The user + */ +/obj/item/device/professor_dummy_tablet/proc/is_adjacent_to_dummy(mob/user) + if (get_dist(linked_dummy, user) > 1) + to_chat(user, "You are too far away to use the tablet.") + return FALSE + + return TRUE + /obj/item/device/professor_dummy_tablet/proc/link_mob(mob/living/carbon/human/H) linked_dummy = H @@ -20,6 +34,12 @@ interact(user) /obj/item/device/professor_dummy_tablet/interact(mob/user as mob) + if (isnull(linked_dummy)) + return + + if (!is_adjacent_to_dummy(user)) + return + user.set_interaction(src) var/dat = "Professor DUMMY Control Tablet" @@ -90,9 +110,11 @@ /obj/item/device/professor_dummy_tablet/Topic(href, href_list) if(..()) return FALSE - usr.set_interaction(src) + if (!is_adjacent_to_dummy(usr)) + return FALSE + usr.set_interaction(src) switch(href_list["operation"]) if ("brute_damage_organ") diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 35097a8e5c79..805b3d7e1744 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -155,7 +155,7 @@ return held_weapon.afterattack(target,src) var/disarm_chance = rand(1, 100) - var/attacker_skill_level = attacking_mob.skills ? skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max + var/attacker_skill_level = skills && attacking_mob.skills ? skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max var/defender_skill_level = skills ? skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max disarm_chance -= 5 * attacker_skill_level disarm_chance += 5 * defender_skill_level