From 09e30bb1aeb6162bfbc86766154d204993bbaaba Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 8 Aug 2022 16:00:26 +0200 Subject: [PATCH] [MIRROR] FIXES RUNTIME EVERYTIME A PAI MOVES [MDB IGNORE] (#15473) * FIXES RUNTIME EVERYTIME A PAI MOVES (#69054) Fixes runtime on movement if a pai fails to put the hacking cable in its holder's hands * FIXES RUNTIME EVERYTIME A PAI MOVES Co-authored-by: ShizCalev --- code/modules/pai/door_jack.dm | 5 +---- code/modules/pai/pai.dm | 3 +++ code/modules/pai/software.dm | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/modules/pai/door_jack.dm b/code/modules/pai/door_jack.dm index 3f7f393a59a..0bb9b50aec6 100644 --- a/code/modules/pai/door_jack.dm +++ b/code/modules/pai/door_jack.dm @@ -36,7 +36,7 @@ QDEL_NULL(hacking_cable) //clear any old cables hacking_cable = new var/mob/living/carbon/hacker = get_holder() - if(hacker?.put_in_hands(hacking_cable)) + if(iscarbon(hacker) && hacker.put_in_hands(hacking_cable)) //important to double check since get_holder can return non-null values that aren't carbons. hacker.visible_message(span_notice("A port on [src] opens to reveal a cable, which you quickly grab."), span_hear("You hear the soft click of a plastic component and manage to catch the falling cable.")) track_pai() track_thing(hacking_cable) @@ -90,10 +90,7 @@ /mob/living/silicon/pai/proc/retract_cable() hacking_cable.visible_message(span_notice("The cable quickly retracts.")) balloon_alert(src, "cable retracted") - untrack_pai() - untrack_thing(hacking_cable) QDEL_NULL(hacking_cable) - SStgui.update_user_uis(src) return TRUE /** diff --git a/code/modules/pai/pai.dm b/code/modules/pai/pai.dm index a4b000cc773..17f16ae9014 100644 --- a/code/modules/pai/pai.dm +++ b/code/modules/pai/pai.dm @@ -183,7 +183,10 @@ /mob/living/silicon/pai/handle_atom_del(atom/deleting_atom) if(deleting_atom == hacking_cable) + untrack_pai() + untrack_thing(hacking_cable) hacking_cable = null + SStgui.update_user_uis(src) if(!QDELETED(card)) card.update_appearance() if(deleting_atom == atmos_analyzer) diff --git a/code/modules/pai/software.dm b/code/modules/pai/software.dm index 3c429adf934..4849d754043 100644 --- a/code/modules/pai/software.dm +++ b/code/modules/pai/software.dm @@ -157,7 +157,7 @@ to_chat(src, span_syndradio("You are not at liberty to do this! All agents are clandestine.")) return FALSE var/mob/living/carbon/holder = get_holder() - if(!holder) + if(!iscarbon(holder)) balloon_alert(src, "not being carried") return FALSE balloon_alert(src, "requesting DNA sample")