From 59c2c73d0f880920d0b0d6394cb4ca9d17de6a3d Mon Sep 17 00:00:00 2001
From: Xufysz <8283338+Xufysz@users.noreply.github.com>
Date: Sat, 26 Aug 2023 18:09:25 +0100
Subject: [PATCH 1/3] Fixes the ability to manipulate a dummy from a distance
using the tablet
---
code/game/objects/items/devices/dummy_tablet.dm | 17 ++++++++++++++++-
.../mob/living/carbon/human/human_attackhand.dm | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/code/game/objects/items/devices/dummy_tablet.dm b/code/game/objects/items/devices/dummy_tablet.dm
index 92cfa4b90e26..0fd924474208 100644
--- a/code/game/objects/items/devices/dummy_tablet.dm
+++ b/code/game/objects/items/devices/dummy_tablet.dm
@@ -12,6 +12,13 @@
linked_dummy = null
. = ..()
+/obj/item/device/professor_dummy_tablet/proc/is_adjacent_to_dummy(mob/user as mob)
+ 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 +27,12 @@
interact(user)
/obj/item/device/professor_dummy_tablet/interact(mob/user as mob)
+ if (linked_dummy == null)
+ return
+
+ if (!is_adjacent_to_dummy(user))
+ return
+
user.set_interaction(src)
var/dat = "
Professor DUMMY Control Tablet"
@@ -90,9 +103,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
From db18425d1dc8b193ae38f7a3e31a1301952ed548 Mon Sep 17 00:00:00 2001
From: Xufysz <8283338+Xufysz@users.noreply.github.com>
Date: Sun, 27 Aug 2023 11:20:28 +0100
Subject: [PATCH 2/3] Makes requested PR changes with a docblock for new proc
---
code/game/objects/items/devices/dummy_tablet.dm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/code/game/objects/items/devices/dummy_tablet.dm b/code/game/objects/items/devices/dummy_tablet.dm
index 0fd924474208..105bf81ea6d0 100644
--- a/code/game/objects/items/devices/dummy_tablet.dm
+++ b/code/game/objects/items/devices/dummy_tablet.dm
@@ -12,7 +12,12 @@
linked_dummy = null
. = ..()
-/obj/item/device/professor_dummy_tablet/proc/is_adjacent_to_dummy(mob/user as mob)
+/**
+ * Checks if the user is adjacent to the dummy.
+ * @param user The user to check.
+ * @return TRUE if the user is adjacent to the dummy, FALSE otherwise.
+*/
+/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
@@ -27,7 +32,7 @@
interact(user)
/obj/item/device/professor_dummy_tablet/interact(mob/user as mob)
- if (linked_dummy == null)
+ if (isnull(linked_dummy))
return
if (!is_adjacent_to_dummy(user))
From 35793a60b139f16b0a7ceec94baff747be3a3c5b Mon Sep 17 00:00:00 2001
From: Xufysz <8283338+Xufysz@users.noreply.github.com>
Date: Sun, 27 Aug 2023 11:23:05 +0100
Subject: [PATCH 3/3] Fixes docblock on new dummy proc
---
code/game/objects/items/devices/dummy_tablet.dm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/code/game/objects/items/devices/dummy_tablet.dm b/code/game/objects/items/devices/dummy_tablet.dm
index 105bf81ea6d0..d1036ebfa93b 100644
--- a/code/game/objects/items/devices/dummy_tablet.dm
+++ b/code/game/objects/items/devices/dummy_tablet.dm
@@ -13,10 +13,12 @@
. = ..()
/**
- * Checks if the user is adjacent to the dummy.
- * @param user The user to check.
- * @return TRUE if the user is adjacent to the dummy, FALSE otherwise.
-*/
+ * 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.")