From a7ebbadb5e9952b03ccdea64bf3390b09da10b9b Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Sun, 29 Sep 2024 08:44:07 +0200 Subject: [PATCH] better way for that (#9080) --- .../code/game/objects/items/weapons/id_cards.dm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modular_chomp/code/game/objects/items/weapons/id_cards.dm b/modular_chomp/code/game/objects/items/weapons/id_cards.dm index 58f1b36a14..ec53910962 100644 --- a/modular_chomp/code/game/objects/items/weapons/id_cards.dm +++ b/modular_chomp/code/game/objects/items/weapons/id_cards.dm @@ -7,11 +7,10 @@ /obj/item/weapon/card/id/exploration/borg/Initialize() . = ..() - if(loc) + if(isrobot(loc?.loc)) R = loc.loc - if(istype(R)) - registered_name = R.braintype - RegisterSignal(src, COMSIG_OBSERVER_MOVED, PROC_REF(check_loc)) + registered_name = R.braintype + RegisterSignal(src, COMSIG_OBSERVER_MOVED, PROC_REF(check_loc)) /obj/item/weapon/card/id/exploration/borg/proc/check_loc(atom/movable/mover, atom/old_loc, atom/new_loc) if(old_loc == R || old_loc == R.module) @@ -26,5 +25,8 @@ hud_layerise() /obj/item/weapon/card/id/exploration/borg/Destroy() - UnregisterSignal(src, COMSIG_OBSERVER_MOVED) + if(R) + UnregisterSignal(src, COMSIG_OBSERVER_MOVED) + R = null + last_robot_loc = null ..()