From 40c2e7109b3353ae4086592d12e67c2424594640 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sun, 12 Jul 2020 16:00:37 +0200 Subject: [PATCH] Not Butts Hacking (#9236) Hacking no longer requires you to hold the tool (wirecutters, multitool, signaler) in your active hand, just that the tool is in one of your hands. This applies to cyborgs as well. --- code/datums/wires/wires.dm | 26 ++++++++++++++----- code/modules/mob/inventory.dm | 15 +++++++++++ .../mob/living/silicon/robot/inventory.dm | 12 +++++++++ html/changelogs/geeves-not_butts_hacking.yml | 6 +++++ 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 html/changelogs/geeves-not_butts_hacking.yml diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 45d72df0d85..72e57c7ba15 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -117,7 +117,7 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown" var/colour = href_list["attach"] // Attach if(!IsAttached(colour)) - var/obj/item/device/assembly/signaler/I = L.get_active_hand() + var/obj/item/device/assembly/signaler/I = L.get_type_in_hands(/obj/item/device/assembly/signaler) if(!istype(I)) to_chat(usr, SPAN_WARNING("You do not have a signaler to attach!")) return @@ -129,22 +129,34 @@ var/list/wireColours = list("red", "blue", "green", "darkred", "orange", "brown" if(O) L.put_in_hands(O) return - var/obj/item/I = L.get_active_hand() - if(!I) - return - holder.add_hiddenprint(L) if(href_list["cut"]) // Toggles the cut/mend status - if(I.iswirecutter()) + var/obj/item/I = L.get_active_hand() + if(!I || !I.iswirecutter()) + if(isrobot(L)) + var/mob/living/silicon/robot/R = L + I = R.return_wirecutter() + else + I = L.get_inactive_hand() + if(I?.iswirecutter()) var/colour = href_list["cut"] CutWireColour(colour) + holder.add_hiddenprint(L) else to_chat(L, SPAN_WARNING("You need wirecutters!")) else if(href_list["pulse"]) - if(I.ismultitool()) + var/obj/item/I = L.get_active_hand() + if(!I || !I.ismultitool()) + if(isrobot(L)) + var/mob/living/silicon/robot/R = L + I = R.return_multitool() + else + I = L.get_inactive_hand() + if(I?.ismultitool()) var/colour = href_list["pulse"] PulseColour(colour) + holder.add_hiddenprint(L) else to_chat(L, SPAN_WARNING("You need a multitool!")) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 0acf02480a8..69f48fa7474 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -130,6 +130,21 @@ var/list/slot_equipment_priority = list( \ if(hand) return r_hand else return l_hand +//Returns the thing if it's a subtype of the requested thing, taking priority of the active hand +/mob/proc/get_type_in_hands(var/type) + if(hand) + if(istype(l_hand, type)) + return l_hand + else if(istype(r_hand, type)) + return r_hand + return + else + if(istype(r_hand, type)) + return r_hand + else if(istype(l_hand, type)) + return l_hand + return + //Puts the item into your l_hand if possible and calls all necessary triggers/updates. returns 1 on success. /mob/proc/put_in_l_hand(var/obj/item/W) if(lying || !istype(W)) diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index bb5fa974b81..562533c3200 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -6,6 +6,18 @@ // TODO: see if refactoring this to return the gripped object (should one exist) works - would make a lot of edge cases a lot simpler return module_active +/mob/living/silicon/robot/proc/return_wirecutter() + for(var/obj/I in list(module_state_1, module_state_2, module_state_3)) + if(I.iswirecutter()) + return I + return + +/mob/living/silicon/robot/proc/return_multitool() + for(var/obj/I in list(module_state_1, module_state_2, module_state_3)) + if(I.ismultitool()) + return I + return + /*-------TODOOOOOOOOOO--------*/ //Verbs used by hotkeys. diff --git a/html/changelogs/geeves-not_butts_hacking.yml b/html/changelogs/geeves-not_butts_hacking.yml new file mode 100644 index 00000000000..f103a072d5c --- /dev/null +++ b/html/changelogs/geeves-not_butts_hacking.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Hacking no longer requires you to hold the tool (wirecutters, multitool, signaler) in your active hand, just that the tool is in one of your hands. This applies to cyborgs as well." \ No newline at end of file