From 5e92c6f05b66e6a7745d581a25414ebd08cdc1f0 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 31 Jul 2020 14:06:48 +0200 Subject: [PATCH] [MIRROR] Fixers for telekinesis and the defibrillator interactions (#149) * Fixers for telekinesis and the defibrillator interactions (#52571) * tk and the defib * fixed range check * extra check that is not needed * only show ear damage on threshold pass * wrong branch am bad * is living check * Fixers for telekinesis and the defibrillator interactions Co-authored-by: NightRed --- code/datums/components/twohanded.dm | 32 ++++++++++++---------- code/game/machinery/defibrillator_mount.dm | 3 ++ code/game/objects/items/defib.dm | 17 +++++------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/code/datums/components/twohanded.dm b/code/datums/components/twohanded.dm index 9cc824dd5e3..3f698241950 100644 --- a/code/datums/components/twohanded.dm +++ b/code/datums/components/twohanded.dm @@ -203,23 +203,25 @@ // Update icons parent_item.update_icon() - if(user.get_item_by_slot(ITEM_SLOT_BACK) == parent) - user.update_inv_back() - else - user.update_inv_hands() - // if the item requires two handed drop the item on unwield - if(require_twohands) - user.dropItemToGround(parent, force=TRUE) - - // Show message if requested - if(show_message) - if(iscyborg(user)) - to_chat(user, "You free up your module.") - else if(require_twohands) - to_chat(user, "You drop [parent].") + if(istype(user)) // tk showed that we might not have a mob here + if(user.get_item_by_slot(ITEM_SLOT_BACK) == parent) + user.update_inv_back() else - to_chat(user, "You are now carrying [parent] with one hand.") + user.update_inv_hands() + + // if the item requires two handed drop the item on unwield + if(require_twohands) + user.dropItemToGround(parent, force=TRUE) + + // Show message if requested + if(show_message) + if(iscyborg(user)) + to_chat(user, "You free up your module.") + else if(require_twohands) + to_chat(user, "You drop [parent].") + else + to_chat(user, "You are now carrying [parent] with one hand.") // Play sound if set if(unwieldsound) diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index 44ba25086b3..c2d4a399bb7 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -72,6 +72,9 @@ if(defib.paddles.loc != defib) to_chat(user, "[defib.paddles.loc == user ? "You are already" : "Someone else is"] holding [defib]'s paddles!") return + if(!in_range(src, user)) + to_chat(user, "[defib]'s paddles overextend and come out of your hands!") + return user.put_in_hands(defib.paddles) /obj/machinery/defibrillator_mount/attackby(obj/item/I, mob/living/user, params) diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 758681d6d87..898f4dfb281 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -334,7 +334,6 @@ . = ..() check_range() - /obj/item/shockpaddles/fire_act(exposed_temperature, exposed_volume) . = ..() if((req_defib && defib) && loc != defib) @@ -344,9 +343,9 @@ if(!req_defib || !defib) return if(!in_range(src,defib)) - var/mob/living/L = loc - if(istype(L)) - to_chat(L, "[defib]'s paddles overextend and come out of your hands!") + if(isliving(loc)) + var/mob/living/user = loc + to_chat(user, "[defib]'s paddles overextend and come out of your hands!") else visible_message("[src] snap back into [defib].") snap_back() @@ -390,14 +389,13 @@ icon_state = "[base_icon_state][wielded]_cooldown" /obj/item/shockpaddles/dropped(mob/user) - if(!req_defib) - return ..() + . = ..() if(user) UnregisterSignal(user, COMSIG_MOVABLE_MOVED) - if(user != loc) + if(req_defib) + if(user) to_chat(user, "The paddles snap back into the main unit.") - snap_back() - return + snap_back() /obj/item/shockpaddles/proc/snap_back() if(!defib) @@ -438,7 +436,6 @@ return var/mob/living/carbon/H = M - if(user.zone_selected != BODY_ZONE_CHEST) to_chat(user, "You need to target your patient's chest with [src]!") return