diff --git a/code/modules/mod/mod_activation.dm b/code/modules/mod/mod_activation.dm index 8430424c894..3d35e58c5a1 100644 --- a/code/modules/mod/mod_activation.dm +++ b/code/modules/mod/mod_activation.dm @@ -145,23 +145,23 @@ module.on_deactivation(display_message = FALSE) activating = TRUE to_chat(wearer, span_notice("MODsuit [active ? "shutting down" : "starting up"].")) - if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, .proc/has_wearer))) to_chat(wearer, span_notice("[boots] [active ? "relax their grip on your legs" : "seal around your feet"].")) playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) seal_part(boots, seal = !active) - if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, .proc/has_wearer))) to_chat(wearer, span_notice("[gauntlets] [active ? "become loose around your fingers" : "tighten around your fingers and wrists"].")) playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) seal_part(gauntlets, seal = !active) - if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, .proc/has_wearer))) to_chat(wearer, span_notice("[chestplate] [active ? "releases your chest" : "cinches tightly against your chest"].")) playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) - seal_part(chestplate,seal = !active) - if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS)) + seal_part(chestplate, seal = !active) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, .proc/has_wearer))) to_chat(wearer, span_notice("[helmet] hisses [active ? "open" : "closed"].")) playsound(src, 'sound/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) seal_part(helmet, seal = !active) - if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS)) + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, .proc/has_wearer))) to_chat(wearer, span_notice("Systems [active ? "shut down. Parts unsealed. Goodbye" : "started up. Parts sealed. Welcome"], [wearer].")) if(ai) to_chat(ai, span_notice("SYSTEMS [active ? "DEACTIVATED. GOODBYE" : "ACTIVATED. WELCOME"]: \"[ai]\"")) @@ -225,10 +225,6 @@ update_icon_state() wearer.update_inv_back() -/obj/item/mod/control/update_icon_state() - icon_state = "[skin]-control[active ? "-sealed" : ""]" - return ..() - /// Quickly deploys all the suit parts and if successful, seals them and turns on the suit. Intended mostly for outfits. /obj/item/mod/control/proc/quick_activation() var/seal = TRUE @@ -241,4 +237,7 @@ seal_part(part, seal = TRUE) finish_activation(on = TRUE) +/obj/item/mod/control/proc/has_wearer() + return wearer + #undef MOD_ACTIVATION_STEP_FLAGS diff --git a/code/modules/mod/mod_control.dm b/code/modules/mod/mod_control.dm index 6db9420979a..56920d22374 100644 --- a/code/modules/mod/mod_control.dm +++ b/code/modules/mod/mod_control.dm @@ -248,6 +248,23 @@ if(slot == ITEM_SLOT_BACK) return TRUE +/obj/item/mod/control/Moved(atom/old_loc, movement_dir, forced = FALSE, list/old_locs) + . = ..() + if(!wearer || old_loc != wearer || loc == wearer) + return + if(active || activating) + for(var/obj/item/mod/module/module as anything in modules) + if(!module.active) + continue + module.on_deactivation(display_message = FALSE) + for(var/obj/item/part as anything in mod_parts) + seal_part(part, seal = FALSE) + for(var/obj/item/part as anything in mod_parts) + conceal(null, part) + if(active) + finish_activation(on = FALSE) + unset_wearer() + /obj/item/mod/control/allow_attack_hand_drop(mob/user) if(user != wearer) return ..() @@ -425,11 +442,14 @@ continue . += module_icons +/obj/item/mod/control/update_icon_state() + icon_state = "[skin]-control[active ? "-sealed" : ""]" + return ..() + /obj/item/mod/control/proc/set_wearer(mob/user) wearer = user SEND_SIGNAL(src, COMSIG_MOD_WEARER_SET, wearer) RegisterSignal(wearer, COMSIG_ATOM_EXITED, .proc/on_exit) - RegisterSignal(src, COMSIG_ITEM_PRE_UNEQUIP, .proc/on_unequip) update_charge_alert() for(var/obj/item/mod/module/module as anything in modules) module.on_equip() @@ -438,18 +458,10 @@ for(var/obj/item/mod/module/module as anything in modules) module.on_unequip() UnregisterSignal(wearer, list(COMSIG_ATOM_EXITED, COMSIG_PROCESS_BORGCHARGER_OCCUPANT)) - UnregisterSignal(src, COMSIG_ITEM_PRE_UNEQUIP) wearer.clear_alert(ALERT_MODSUIT_CHARGE) SEND_SIGNAL(src, COMSIG_MOD_WEARER_UNSET, wearer) wearer = null -/obj/item/mod/control/proc/on_unequip() - SIGNAL_HANDLER - - for(var/obj/item/part as anything in mod_parts) - if(part.loc != src) - return COMPONENT_ITEM_BLOCK_UNEQUIP - /obj/item/mod/control/proc/update_flags() var/list/used_skin = theme.skins[skin] for(var/obj/item/clothing/part as anything in mod_parts)