From 0f684bd7db1c0fa71fc92b97a77526791d388da0 Mon Sep 17 00:00:00 2001 From: Fikou <23585223+Fikou@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:12:49 +0100 Subject: [PATCH] fixes issues with the separate modsuit part activation (#87482) ## About The Pull Request generally cleans up the code a bit. fixes the issue where if you had clothing on yourself already and you tried extending when active it still went through the sealing process even though it didnt extend the part, causing weird desyncs. fixes the issues with part enabled modules that would not activate, makes stealth and radproof modules require the whole suit to be out cause thinking about it they wouldnt really work without that i think reverts quick activation to try put parts on you instead of removing them as priority, i think that plays nicer with separate part activation fixes #87413 --- code/__DEFINES/mobs.dm | 3 - code/datums/storage/storage.dm | 5 +- code/modules/mod/mod_activation.dm | 142 +++++++++++------- code/modules/mod/mod_control.dm | 15 +- code/modules/mod/mod_theme.dm | 64 -------- code/modules/mod/modules/_module.dm | 20 ++- code/modules/mod/modules/modules_antag.dm | 59 ++++---- .../mod/modules/modules_engineering.dm | 31 ++-- code/modules/mod/modules/modules_general.dm | 32 ++-- code/modules/mod/modules/modules_maint.dm | 4 +- code/modules/mod/modules/modules_medical.dm | 6 +- code/modules/mod/modules/modules_ninja.dm | 16 +- code/modules/mod/modules/modules_security.dm | 24 +-- code/modules/mod/modules/modules_service.dm | 4 +- code/modules/mod/modules/modules_supply.dm | 14 +- .../surgery/bodyparts/dismemberment.dm | 26 ++-- code/modules/unit_tests/dismemberment.dm | 4 +- 17 files changed, 225 insertions(+), 244 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 57f56f2db64..97a86538e3a 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -837,9 +837,6 @@ GLOBAL_LIST_INIT(layers_to_offset, list( /// The layer above mutant body parts #define ABOVE_BODY_FRONT_LAYER (BODY_FRONT_LAYER-1) -/// We need gloves to layer on top of modsuit chestplates because we need the hole in the suit filled in if the user lacks a limb -#define MOD_CHESTPLATE_LAYER (GLOVES_LAYER+0.5) - /// If gravity must be present to perform action (can't use pens without gravity) #define NEED_GRAVITY (1<<0) /// If reading is required to perform action (can't read a book if you are illiterate) diff --git a/code/datums/storage/storage.dm b/code/datums/storage/storage.dm index feda199d670..2cf18c0767a 100644 --- a/code/datums/storage/storage.dm +++ b/code/datums/storage/storage.dm @@ -171,6 +171,7 @@ arrived.item_flags |= IN_STORAGE refresh_views() arrived.on_enter_storage(src) + RegisterSignal(arrived, COMSIG_MOUSEDROPPED_ONTO, PROC_REF(mousedrop_receive)) SEND_SIGNAL(arrived, COMSIG_ITEM_STORED, src) parent.update_appearance() @@ -184,6 +185,7 @@ gone.item_flags &= ~IN_STORAGE remove_and_refresh(gone) gone.on_exit_storage(src) + UnregisterSignal(gone, COMSIG_MOUSEDROPPED_ONTO) SEND_SIGNAL(gone, COMSIG_ITEM_UNSTORED, src) parent.update_appearance() @@ -451,7 +453,6 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) SEND_SIGNAL(parent, COMSIG_ATOM_STORED_ITEM, to_insert, user, force) SEND_SIGNAL(src, COMSIG_STORAGE_STORED_ITEM, to_insert, user, force) - RegisterSignal(to_insert, COMSIG_MOUSEDROPPED_ONTO, PROC_REF(mousedrop_receive)) to_insert.forceMove(real_location) item_insertion_feedback(user, to_insert, override) parent.update_appearance() @@ -468,7 +469,6 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) return if (target.loc != real_location) // what even - UnregisterSignal(target, COMSIG_MOUSEDROPPED_ONTO) return if(numerical_stacking) @@ -573,7 +573,6 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) refresh_views() parent.update_appearance() - UnregisterSignal(thing, COMSIG_MOUSEDROPPED_ONTO) SEND_SIGNAL(parent, COMSIG_ATOM_REMOVED_ITEM, thing, remove_to_loc, silent) SEND_SIGNAL(src, COMSIG_STORAGE_REMOVED_ITEM, thing, remove_to_loc, silent) return TRUE diff --git a/code/modules/mod/mod_activation.dm b/code/modules/mod/mod_activation.dm index a8ac2474142..ed19d0a4f6a 100644 --- a/code/modules/mod/mod_activation.dm +++ b/code/modules/mod/mod_activation.dm @@ -26,8 +26,7 @@ return var/parts_to_check = parts - part if(part.loc == src) - deploy(user, part) - if(active && !delayed_seal_part(part)) + if(!deploy(user, part) || (active && !delayed_seal_part(part))) return SEND_SIGNAL(src, COMSIG_MOD_DEPLOYED, user) for(var/obj/item/checking_part as anything in parts_to_check) @@ -36,9 +35,8 @@ choose_deploy(user) break else - if(active && !delayed_seal_part(part)) + if((active && !delayed_seal_part(part, silent = TRUE)) || !retract(user, part)) return - retract(user, part) SEND_SIGNAL(src, COMSIG_MOD_RETRACTED, user) for(var/obj/item/checking_part as anything in parts_to_check) if(checking_part.loc == src) @@ -49,28 +47,30 @@ /// Quickly deploys all parts (or retracts if all are on the wearer) /obj/item/mod/control/proc/quick_deploy(mob/user) if(activating) - balloon_alert(user, "currently sealing/unsealing!") + balloon_alert(user, "currently [active ? "unsealing" : "sealing"]!") playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) return FALSE - var/deploy = TRUE + var/deploy = FALSE for(var/obj/item/part as anything in get_parts()) - if(part.loc == src) + if(part.loc != src) continue - deploy = FALSE + deploy = TRUE break + wearer.visible_message(span_notice("[wearer]'s [src] [deploy ? "deploys" : "retracts"] its parts with a mechanical hiss."), + span_notice("[src] [deploy ? "deploys" : "retracts"] its parts with a mechanical hiss."), + span_hear("You hear a mechanical hiss.")) + playsound(src, 'sound/vehicles/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) for(var/obj/item/part as anything in get_parts()) if(deploy && part.loc == src) - deploy(null, part) + if(!deploy(null, part)) + continue if(active && !delayed_seal_part(part)) + retract(null, part) return else if(!deploy && part.loc != src) if(active && !delayed_seal_part(part)) return retract(null, part) - wearer.visible_message(span_notice("[wearer]'s [src] [deploy ? "deploys" : "retracts"] its parts with a mechanical hiss."), - span_notice("[src] [deploy ? "deploys" : "retracts"] its parts with a mechanical hiss."), - span_hear("You hear a mechanical hiss.")) - playsound(src, 'sound/vehicles/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) if(deploy) SEND_SIGNAL(src, COMSIG_MOD_DEPLOYED, user) else @@ -96,6 +96,7 @@ RegisterSignal(part, COMSIG_ATOM_EXITED, PROC_REF(on_overslot_exit)) if(wearer.equip_to_slot_if_possible(part, part.slot_flags, qdel_on_fail = FALSE, disable_warning = TRUE)) ADD_TRAIT(part, TRAIT_NODROP, MOD_TRAIT) + wearer.update_clothing(slot_flags) if(!user) return TRUE wearer.visible_message(span_notice("[wearer]'s [part.name] deploy[part.p_s()] with a mechanical hiss."), @@ -105,6 +106,10 @@ SEND_SIGNAL(src, COMSIG_MOD_PART_DEPLOYED, user, part) return TRUE else + if(part_datum.overslotting) + var/obj/item/overslot = part_datum.overslotting + if(!wearer.equip_to_slot_if_possible(overslot, overslot.slot_flags, qdel_on_fail = FALSE, disable_warning = TRUE)) + wearer.dropItemToGround(overslot, force = TRUE, silent = TRUE) if(!user) return FALSE balloon_alert(user, "bodypart clothed!") @@ -119,21 +124,22 @@ return FALSE balloon_alert(user, "[part.name] already retracted!") playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) + return FALSE REMOVE_TRAIT(part, TRAIT_NODROP, MOD_TRAIT) wearer.transferItemToLoc(part, src, force = TRUE) if(part_datum.overslotting) - UnregisterSignal(part, COMSIG_ATOM_EXITED) var/obj/item/overslot = part_datum.overslotting if(!QDELING(wearer) && !wearer.equip_to_slot_if_possible(overslot, overslot.slot_flags, qdel_on_fail = FALSE, disable_warning = TRUE)) wearer.dropItemToGround(overslot, force = TRUE, silent = TRUE) - part_datum.overslotting = null + wearer.update_clothing(slot_flags) SEND_SIGNAL(src, COMSIG_MOD_PART_RETRACTED, user, part) if(!user) - return + return TRUE wearer.visible_message(span_notice("[wearer]'s [part.name] retract[part.p_s()] back into [src] with a mechanical hiss."), span_notice("[part] retract[part.p_s()] back into [src] with a mechanical hiss."), span_hear("You hear a mechanical hiss.")) playsound(src, 'sound/vehicles/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) + return TRUE /// Starts the activation sequence, where parts of the suit activate one by one until the whole suit is on. /obj/item/mod/control/proc/toggle_activate(mob/user, force_deactivate = FALSE) @@ -168,46 +174,71 @@ module.deactivate(display_message = FALSE) activating = TRUE mod_link.end_call() + var/original_active_status = active to_chat(wearer, span_notice("MODsuit [active ? "shutting down" : "starting up"].")) //deploy the control unit - if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, PROC_REF(get_wearer)), hidden = TRUE)) - playsound(src, active ? 'sound/machines/synth/synth_no.ogg' : 'sound/machines/synth/synth_yes.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, frequency = 8000) - else - activating = FALSE - return + if(original_active_status) + if(delayed_activation()) + playsound(src, 'sound/machines/synth/synth_no.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, frequency = 6000) + to_chat(wearer, span_notice("Control unit offline. Module capability removed.")) + else + activating = FALSE + return + + var/list/sealed_parts = list() for(var/obj/item/part as anything in get_parts()) //seals/unseals all deployed parts if(part.loc == src) continue - delayed_seal_part(part, no_activation = TRUE) + if(!delayed_seal_part(part)) //shit something broke, revert it all + activating = FALSE + for(var/obj/item/sealed_part as anything in sealed_parts) + seal_part(sealed_part, is_sealed = !get_part_datum(sealed_part).sealed) + if(original_active_status) + control_activation(is_on = TRUE) + to_chat(wearer, span_notice("Critical error in sealing systems. Reverting process.")) + playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) + return + sealed_parts += part - //finish activation - to_chat(wearer, span_notice("Systems [active ? "shut down. Parts unsealed. Goodbye" : "started up. Parts sealed. Welcome"], [wearer].")) + if(!original_active_status) + if(delayed_activation()) + playsound(src, 'sound/machines/synth/synth_yes.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, frequency = 6000) + if(!malfunctioning) + wearer.playsound_local(get_turf(src), 'sound/vehicles/mecha/nominal.ogg', 50) + else + activating = FALSE + for(var/obj/item/sealed_part as anything in sealed_parts) + seal_part(sealed_part, is_sealed = !get_part_datum(sealed_part).sealed) + to_chat(wearer, span_notice("Critical error in sealing systems. Reverting process.")) + playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, TRUE, SILENCED_SOUND_EXTRARANGE) + return + + to_chat(wearer, span_notice("Systems [active ? "started up. Parts sealed. Welcome" : "shut down. Parts unsealed. Goodbye"], [wearer].")) if(ai_assistant) - to_chat(ai_assistant, span_notice("SYSTEMS [active ? "DEACTIVATED. GOODBYE" : "ACTIVATED. WELCOME"]: \"[ai_assistant]\"")) - finish_activation(is_on = !active) - if(active) - playsound(src, 'sound/machines/synth/synth_yes.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, frequency = 6000) - if(!malfunctioning) - wearer.playsound_local(get_turf(src), 'sound/vehicles/mecha/nominal.ogg', 50) - else - playsound(src, 'sound/machines/synth/synth_no.ogg', 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, frequency = 6000) - + to_chat(ai_assistant, span_notice("SYSTEMS [active ? "ACTIVATED. WELCOME" : "DEACTIVATED. GOODBYE"]: \"[ai_assistant]\"")) activating = FALSE SEND_SIGNAL(src, COMSIG_MOD_TOGGLED, user) return TRUE -/obj/item/mod/control/proc/delayed_seal_part(obj/item/clothing/part, no_activation = FALSE) +/obj/item/mod/control/proc/delayed_seal_part(obj/item/clothing/part, silent = FALSE) . = FALSE var/datum/mod_part/part_datum = get_part_datum(part) if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, PROC_REF(get_wearer)), hidden = TRUE)) - to_chat(wearer, span_notice("[part] [!part_datum.sealed ? part_datum.sealed_message : part_datum.unsealed_message].")) - playsound(src, 'sound/vehicles/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) - seal_part(part, is_sealed = !part_datum.sealed, no_activation = no_activation) + if(!silent) + to_chat(wearer, span_notice("[part] [!part_datum.sealed ? part_datum.sealed_message : part_datum.unsealed_message].")) + playsound(src, 'sound/vehicles/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) + seal_part(part, is_sealed = !part_datum.sealed) + return TRUE + +/obj/item/mod/control/proc/delayed_activation() + . = FALSE + if(do_after(wearer, activation_step_time, wearer, MOD_ACTIVATION_STEP_FLAGS, extra_checks = CALLBACK(src, PROC_REF(get_wearer)), hidden = TRUE)) + control_activation(is_on = !active) return TRUE ///Seals or unseals the given part. -/obj/item/mod/control/proc/seal_part(obj/item/clothing/part, is_sealed, no_activation = FALSE) +/obj/item/mod/control/proc/seal_part(obj/item/clothing/part, is_sealed) var/datum/mod_part/part_datum = get_part_datum(part) part_datum.sealed = is_sealed if(part_datum.sealed) @@ -231,38 +262,41 @@ wearer.update_obscured_slots(part.visor_flags_inv) if((part.clothing_flags & (MASKINTERNALS|HEADINTERNALS)) && wearer.invalid_internals()) wearer.cutoff_internals() - if(!active || no_activation) + if(!active) return - // these only matter during sealing and unsealing while active via deployment if(is_sealed) for(var/obj/item/mod/module/module as anything in modules) - if(!module.has_required_parts(list("[part.slot_flags]" = part_datum), need_extended = TRUE)) + if(module.part_activated || !module.has_required_parts(mod_parts, need_active = TRUE)) continue - module.on_suit_activation() + module.on_part_activation() + module.part_activated = TRUE else for(var/obj/item/mod/module/module as anything in modules) - if(!module.has_required_parts(list("[part.slot_flags]" = part_datum), need_extended = TRUE)) + if(!module.part_activated || module.has_required_parts(mod_parts, need_active = TRUE)) continue - module.on_suit_deactivation() + module.on_part_deactivation() + module.part_activated = FALSE if(!module.active || (module.allow_flags & MODULE_ALLOW_INACTIVE)) continue module.deactivate(display_message = FALSE) /// Finishes the suit's activation -/obj/item/mod/control/proc/finish_activation(is_on) +/obj/item/mod/control/proc/control_activation(is_on) var/datum/mod_part/part_datum = get_part_datum(src) part_datum.sealed = is_on active = is_on if(active) for(var/obj/item/mod/module/module as anything in modules) - if(!module.has_required_parts(mod_parts, need_extended = TRUE)) + if(module.part_activated || !module.has_required_parts(mod_parts, need_active = TRUE)) continue - module.on_suit_activation() + module.on_part_activation() + module.part_activated = TRUE else for(var/obj/item/mod/module/module as anything in modules) - if(!module.has_required_parts(mod_parts, need_extended = TRUE)) //it probably will runtime if we dont do this + if(!module.part_activated || module.has_required_parts(mod_parts, need_active = TRUE)) continue - module.on_suit_deactivation() + module.on_part_deactivation() + module.part_activated = FALSE update_speed() update_charge_alert() update_appearance(UPDATE_ICON_STATE) @@ -271,14 +305,12 @@ /// 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 for(var/obj/item/part as anything in get_parts()) - if(!deploy(null, part)) - seal = FALSE - if(!seal) - return + deploy(null, part) for(var/obj/item/part as anything in get_parts()) + if(part.loc == src) + continue seal_part(part, is_sealed = TRUE) - finish_activation(is_on = TRUE) + control_activation(is_on = TRUE) #undef MOD_ACTIVATION_STEP_FLAGS diff --git a/code/modules/mod/mod_control.dm b/code/modules/mod/mod_control.dm index 18ecd44c3e7..0f521e40691 100644 --- a/code/modules/mod/mod_control.dm +++ b/code/modules/mod/mod_control.dm @@ -513,7 +513,7 @@ for(var/obj/item/part as anything in get_parts()) retract(null, part) if(active) - finish_activation(is_on = FALSE) + control_activation(is_on = FALSE) mod_link?.end_call() var/mob/old_wearer = wearer unset_wearer() @@ -607,8 +607,9 @@ new_module.on_install() if(wearer) new_module.on_equip() - if(active && new_module.has_required_parts(mod_parts, need_extended = TRUE)) - new_module.on_suit_activation() + if(active && new_module.has_required_parts(mod_parts, need_active = TRUE)) + new_module.on_part_activation() + new_module.part_activated = TRUE if(user) balloon_alert(user, "[new_module] added") playsound(src, 'sound/machines/click.ogg', 50, TRUE, SILENCED_SOUND_EXTRARANGE) @@ -619,7 +620,7 @@ if(wearer) old_module.on_unequip() if(active) - old_module.on_suit_deactivation(deleting = deleting) + old_module.on_part_deactivation(deleting = deleting) if(old_module.active) old_module.deactivate(display_message = !deleting, deleting = deleting) old_module.UnregisterSignal(src, COMSIG_ITEM_GET_WORN_OVERLAYS) @@ -678,7 +679,7 @@ /obj/item/mod/control/proc/update_speed() for(var/obj/item/part as anything in get_parts(all = TRUE)) - part.slowdown = (active ? slowdown_active : slowdown_inactive) / length(mod_parts) + part.slowdown = (get_part_datum(part).sealed ? slowdown_active : slowdown_inactive) / length(mod_parts) wearer?.update_equipment_speed_mods() /obj/item/mod/control/proc/power_off() @@ -705,6 +706,9 @@ uninstall(part) return if(part in get_parts()) + var/datum/mod_part/part_datum = get_part_datum(part) + if(part_datum.sealed) + seal_part(part, is_sealed = FALSE) if(isnull(part.loc)) return if(!wearer) @@ -733,6 +737,7 @@ var/datum/mod_part/part_datum = get_part_datum(part) if(overslot != part_datum.overslotting) return + UnregisterSignal(part, COMSIG_ATOM_EXITED) part_datum.overslotting = null /obj/item/mod/control/proc/on_potion(atom/movable/source, obj/item/slimepotion/speed/speed_potion, mob/living/user) diff --git a/code/modules/mod/mod_theme.dm b/code/modules/mod/mod_theme.dm index 664f9118b83..76f9063df0b 100644 --- a/code/modules/mod/mod_theme.dm +++ b/code/modules/mod/mod_theme.dm @@ -62,8 +62,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -205,8 +203,6 @@ SEALED_COVER = HEADCOVERSEYES, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_INVISIBILITY = HIDEJUMPSUIT, UNSEALED_MESSAGE = CHESTPLATE_UNSEAL_MESSAGE, @@ -270,8 +266,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -340,8 +334,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -414,8 +406,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -490,8 +480,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = THICKMATERIAL|STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT|HIDEBELT, @@ -524,8 +512,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = THICKMATERIAL|STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT|HIDEBELT, @@ -602,8 +588,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, UNSEALED_MESSAGE = CHESTPLATE_UNSEAL_MESSAGE, SEALED_MESSAGE = CHESTPLATE_SEAL_MESSAGE, @@ -676,8 +660,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -711,8 +693,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -793,8 +773,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -867,8 +845,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -936,8 +912,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1005,8 +979,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1080,8 +1052,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1150,8 +1120,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1227,8 +1195,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1262,8 +1228,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1337,8 +1301,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1414,8 +1376,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_INVISIBILITY = HIDEJUMPSUIT|HIDEMUTWINGS, CAN_OVERSLOT = TRUE, @@ -1501,8 +1461,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1573,8 +1531,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL|CASTING_CLOTHES, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1644,8 +1600,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1717,8 +1671,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1787,8 +1739,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1856,8 +1806,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1889,8 +1837,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -1973,8 +1919,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -2044,8 +1988,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -2110,8 +2052,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -2178,8 +2118,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL, SEALED_CLOTHING = STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, @@ -2245,8 +2183,6 @@ SEALED_MESSAGE = HELMET_SEAL_MESSAGE, ), /obj/item/clothing/suit/mod = list( - UNSEALED_LAYER = MOD_CHESTPLATE_LAYER, - SEALED_LAYER = MOD_CHESTPLATE_LAYER, UNSEALED_CLOTHING = THICKMATERIAL|STOPSPRESSUREDAMAGE, SEALED_INVISIBILITY = HIDEJUMPSUIT, UNSEALED_MESSAGE = CHESTPLATE_UNSEAL_MESSAGE, diff --git a/code/modules/mod/modules/_module.dm b/code/modules/mod/modules/_module.dm index ad0ca106bd1..391eef60eb4 100644 --- a/code/modules/mod/modules/_module.dm +++ b/code/modules/mod/modules/_module.dm @@ -39,6 +39,10 @@ var/cooldown_time = 0 /// The mouse button needed to use this module var/used_signal + /// Are all parts needed active- have we ran on_part_activation + var/part_activated = FALSE + /// Do we need the parts to be extended to run process + var/part_process = TRUE /// List of REF()s mobs we are pinned to, linked with their action buttons var/list/pinned_to = list() /// flags that let the module ability be used in odd circumstances @@ -79,14 +83,14 @@ . += span_notice("Complexity level: [complexity]") /// Looks through the MODsuit's parts to see if it has the parts required to support this module -/obj/item/mod/module/proc/has_required_parts(list/parts, need_extended = FALSE) +/obj/item/mod/module/proc/has_required_parts(list/parts, need_active = FALSE) if(!length(required_slots)) return TRUE var/total_slot_flags = NONE for(var/part_slot in parts) - if(need_extended) + if(need_active) var/datum/mod_part/part_datum = parts[part_slot] - if(part_datum.part_item.loc == mod) + if(!part_datum.sealed) continue total_slot_flags |= text2num(part_slot) var/list/needed_slots = required_slots.Copy() @@ -110,7 +114,7 @@ if(mod.wearer) balloon_alert(mod.wearer, "not active!") return - if(!has_required_parts(mod.mod_parts, need_extended = TRUE)) + if(!has_required_parts(mod.mod_parts, need_active = TRUE)) if(mod.wearer) balloon_alert(mod.wearer, "required parts inactive!") var/list/slot_strings = list() @@ -231,6 +235,8 @@ /// Called on the MODsuit's process /obj/item/mod/module/proc/on_process(seconds_per_tick) + if(part_process && !part_activated) + return FALSE if(active) if(!drain_power(active_power_cost * seconds_per_tick)) deactivate() @@ -265,11 +271,11 @@ return /// Called when the MODsuit is activated -/obj/item/mod/module/proc/on_suit_activation() +/obj/item/mod/module/proc/on_part_activation() return /// Called when the MODsuit is deactivated -/obj/item/mod/module/proc/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/proc/on_part_deactivation(deleting = FALSE) return /// Called when the MODsuit is equipped @@ -337,7 +343,7 @@ /// Generates an icon to be used for the suit's worn overlays /obj/item/mod/module/proc/generate_worn_overlay(mutable_appearance/standing) . = list() - if(!mod.active || !has_required_parts(mod.mod_parts, need_extended = TRUE)) + if(!mod.active || !has_required_parts(mod.mod_parts, need_active = TRUE)) return var/used_overlay = get_current_overlay_state() if (!used_overlay) diff --git a/code/modules/mod/modules/modules_antag.dm b/code/modules/mod/modules/modules_antag.dm index d1394ad3d7e..e2ec36fe377 100644 --- a/code/modules/mod/modules/modules_antag.dm +++ b/code/modules/mod/modules/modules_antag.dm @@ -37,12 +37,12 @@ laser = 15 energy = 15 -/obj/item/mod/module/armor_booster/on_suit_activation() +/obj/item/mod/module/armor_booster/on_part_activation() var/obj/item/clothing/head_cover = mod.get_part_from_slot(ITEM_SLOT_HEAD) || mod.get_part_from_slot(ITEM_SLOT_MASK) || mod.get_part_from_slot(ITEM_SLOT_EYES) if(istype(head_cover)) head_cover.flash_protect = FLASH_PROTECTION_WELDER -/obj/item/mod/module/armor_booster/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/armor_booster/on_part_deactivation(deleting = FALSE) if(deleting) return var/obj/item/clothing/head_cover = mod.get_part_from_slot(ITEM_SLOT_HEAD) || mod.get_part_from_slot(ITEM_SLOT_MASK) || mod.get_part_from_slot(ITEM_SLOT_EYES) @@ -53,36 +53,38 @@ playsound(src, 'sound/vehicles/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) balloon_alert(mod.wearer, "armor boosted, EVA lost") actual_speed_added = max(0, min(mod.slowdown_active, speed_added)) - mod.slowdown -= actual_speed_added - mod.wearer.update_equipment_speed_mods() var/obj/item/clothing/head_cover = mod.get_part_from_slot(ITEM_SLOT_HEAD) || mod.get_part_from_slot(ITEM_SLOT_MASK) || mod.get_part_from_slot(ITEM_SLOT_EYES) if(istype(head_cover)) ADD_TRAIT(mod.wearer, TRAIT_HEAD_INJURY_BLOCKED, MOD_TRAIT) + var/list/mod_parts = mod.get_parts(all = TRUE) for(var/obj/item/part as anything in mod.get_parts(all = TRUE)) part.set_armor(part.get_armor().add_other_armor(armor_mod)) + part.slowdown -= speed_added / length(mod_parts) if(!remove_pressure_protection || !isclothing(part)) continue var/obj/item/clothing/clothing_part = part if(clothing_part.clothing_flags & STOPSPRESSUREDAMAGE) clothing_part.clothing_flags &= ~STOPSPRESSUREDAMAGE spaceproofed[clothing_part] = TRUE + mod.wearer.update_equipment_speed_mods() /obj/item/mod/module/armor_booster/on_deactivation(display_message = TRUE, deleting = FALSE) if(!deleting) playsound(src, 'sound/vehicles/mecha/mechmove03.ogg', 25, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) balloon_alert(mod.wearer, "armor retracts, EVA ready") - mod.slowdown += actual_speed_added - mod.wearer.update_equipment_speed_mods() var/obj/item/clothing/head_cover = mod.get_part_from_slot(ITEM_SLOT_HEAD) || mod.get_part_from_slot(ITEM_SLOT_MASK) || mod.get_part_from_slot(ITEM_SLOT_EYES) if(istype(head_cover)) REMOVE_TRAIT(mod.wearer, TRAIT_HEAD_INJURY_BLOCKED, MOD_TRAIT) + var/list/mod_parts = mod.get_parts(all = TRUE) for(var/obj/item/part as anything in mod.get_parts(all = TRUE)) part.set_armor(part.get_armor().subtract_other_armor(armor_mod)) + part.slowdown += speed_added / length(mod_parts) if(!remove_pressure_protection || !isclothing(part)) continue var/obj/item/clothing/clothing_part = part if(spaceproofed[clothing_part]) clothing_part.clothing_flags |= STOPSPRESSUREDAMAGE + mod.wearer.update_equipment_speed_mods() spaceproofed = list() /obj/item/mod/module/armor_booster/generate_worn_overlay(mutable_appearance/standing) @@ -126,12 +128,12 @@ . = ..() charges = max_charges -/obj/item/mod/module/energy_shield/on_suit_activation() +/obj/item/mod/module/energy_shield/on_part_activation() mod.AddComponent(/datum/component/shielded, max_charges = max_charges, recharge_start_delay = recharge_start_delay, charge_increment_delay = charge_increment_delay, \ charge_recovery = charge_recovery, lose_multiple_charges = lose_multiple_charges, recharge_path = recharge_path, starting_charges = charges, shield_icon_file = shield_icon_file, shield_icon = shield_icon) RegisterSignal(mod.wearer, COMSIG_LIVING_CHECK_BLOCK, PROC_REF(shield_reaction)) -/obj/item/mod/module/energy_shield/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/energy_shield/on_part_deactivation(deleting = FALSE) var/datum/component/shielded/shield = mod.GetComponent(/datum/component/shielded) charges = shield.current_charges qdel(shield) @@ -182,10 +184,10 @@ incompatible_modules = list(/obj/item/mod/module/anti_magic) required_slots = list(ITEM_SLOT_BACK) -/obj/item/mod/module/anti_magic/on_suit_activation() +/obj/item/mod/module/anti_magic/on_part_activation() mod.wearer.add_traits(list(TRAIT_ANTIMAGIC, TRAIT_HOLY), MOD_TRAIT) -/obj/item/mod/module/anti_magic/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/anti_magic/on_part_deactivation(deleting = FALSE) mod.wearer.remove_traits(list(TRAIT_ANTIMAGIC, TRAIT_HOLY), MOD_TRAIT) /obj/item/mod/module/anti_magic/wizard @@ -197,10 +199,10 @@ icon_state = "magic_neutralizer" required_slots = list() -/obj/item/mod/module/anti_magic/wizard/on_suit_activation() +/obj/item/mod/module/anti_magic/wizard/on_part_activation() mod.wearer.add_traits(list(TRAIT_ANTIMAGIC, TRAIT_ANTIMAGIC_NO_SELFBLOCK), MOD_TRAIT) -/obj/item/mod/module/anti_magic/wizard/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/anti_magic/wizard/on_part_deactivation(deleting = FALSE) mod.wearer.remove_traits(list(TRAIT_ANTIMAGIC, TRAIT_ANTIMAGIC_NO_SELFBLOCK), MOD_TRAIT) ///Insignia - Gives you a skin specific stripe. @@ -260,10 +262,10 @@ incompatible_modules = list(/obj/item/mod/module/noslip) required_slots = list(ITEM_SLOT_FEET) -/obj/item/mod/module/noslip/on_suit_activation() +/obj/item/mod/module/noslip/on_part_activation() ADD_TRAIT(mod.wearer, TRAIT_NO_SLIP_WATER, MOD_TRAIT) -/obj/item/mod/module/noslip/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/noslip/on_part_deactivation(deleting = FALSE) REMOVE_TRAIT(mod.wearer, TRAIT_NO_SLIP_WATER, MOD_TRAIT) //Bite of 87 Springlock - Equips faster, disguised as DNA lock. @@ -279,7 +281,7 @@ complexity = initial(the_dna_lock_behind_the_slaughter.complexity) use_energy_cost = initial(the_dna_lock_behind_the_slaughter.use_energy_cost) -/obj/item/mod/module/springlock/bite_of_87/on_suit_activation() +/obj/item/mod/module/springlock/bite_of_87/on_part_activation() ..() if(check_holidays(APRIL_FOOLS) || prob(1)) mod.set_mod_color("#b17f00") @@ -485,11 +487,11 @@ required_slots = list(ITEM_SLOT_BACK|ITEM_SLOT_BELT) var/datum/proximity_monitor/advanced/demoraliser/demoralizer -/obj/item/mod/module/demoralizer/on_suit_activation() +/obj/item/mod/module/demoralizer/on_part_activation() var/datum/demoralise_moods/module/mood_category = new() demoralizer = new(mod.wearer, 7, TRUE, mood_category) -/obj/item/mod/module/demoralizer/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/demoralizer/on_part_deactivation(deleting = FALSE) QDEL_NULL(demoralizer) /obj/item/mod/module/infiltrator @@ -512,7 +514,7 @@ /obj/item/mod/module/infiltrator/on_uninstall(deleting = FALSE) mod.item_flags &= ~EXAMINE_SKIP -/obj/item/mod/module/infiltrator/on_suit_activation() +/obj/item/mod/module/infiltrator/on_part_activation() mod.wearer.add_traits(traits_to_add, MOD_TRAIT) RegisterSignal(mod.wearer, COMSIG_TRY_MODIFY_SPEECH, PROC_REF(on_speech_modification)) var/obj/item/organ/tongue/user_tongue = mod.wearer.get_organ_slot(ORGAN_SLOT_TONGUE) @@ -521,7 +523,7 @@ if(istype(head_cover)) head_cover.flash_protect = FLASH_PROTECTION_WELDER_HYPER_SENSITIVE -/obj/item/mod/module/infiltrator/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/infiltrator/on_part_deactivation(deleting = FALSE) mod.wearer.remove_traits(traits_to_add, MOD_TRAIT) UnregisterSignal(mod.wearer, COMSIG_TRY_MODIFY_SPEECH) var/obj/item/organ/tongue/user_tongue = mod.wearer.get_organ_slot(ORGAN_SLOT_TONGUE) @@ -584,7 +586,16 @@ if(disrupted.on_saboteur(src, 1 MINUTES)) mod.add_charge(DEFAULT_CHARGE_DRAIN * 250) -/obj/item/mod/module/stealth/wraith/on_suit_activation() +/obj/item/mod/module/stealth/wraith/on_part_activation() + start_stealth() + +/obj/item/mod/module/stealth/wraith/on_part_deactivation(deleting) + if(bumpoff) + UnregisterSignal(mod.wearer, COMSIG_LIVING_MOB_BUMP) + UnregisterSignal(mod.wearer, list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_MOB_ITEM_ATTACK, COMSIG_ATOM_ATTACKBY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_BULLET_ACT, COMSIG_ATOM_HITBY, COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_PAW, COMSIG_CARBON_CUFF_ATTEMPTED)) + animate(mod.wearer, alpha = 255, time = 1.5 SECONDS) + +/obj/item/mod/module/stealth/wraith/proc/start_stealth() if(bumpoff) RegisterSignal(mod.wearer, COMSIG_LIVING_MOB_BUMP, PROC_REF(unstealth)) RegisterSignal(mod.wearer, COMSIG_LIVING_UNARMED_ATTACK, PROC_REF(on_unarmed_attack)) @@ -593,16 +604,10 @@ animate(mod.wearer, alpha = stealth_alpha, time = 1.5 SECONDS) drain_power(use_energy_cost) -/obj/item/mod/module/stealth/wraith/on_suit_deactivation(deleting) - if(bumpoff) - UnregisterSignal(mod.wearer, COMSIG_LIVING_MOB_BUMP) - UnregisterSignal(mod.wearer, list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_MOB_ITEM_ATTACK, COMSIG_ATOM_ATTACKBY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_BULLET_ACT, COMSIG_ATOM_HITBY, COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_PAW, COMSIG_CARBON_CUFF_ATTEMPTED)) - animate(mod.wearer, alpha = 255, time = 1.5 SECONDS) - /obj/item/mod/module/stealth/wraith/unstealth(datum/source) . = ..() if(mod.active) - addtimer(CALLBACK(src, PROC_REF(on_suit_activation)), 5 SECONDS) + addtimer(CALLBACK(src, PROC_REF(start_stealth)), 5 SECONDS) /obj/item/mod/module/stealth/wraith/examine_more(mob/user) . = ..() diff --git a/code/modules/mod/modules/modules_engineering.dm b/code/modules/mod/modules/modules_engineering.dm index 9ddb0f9351c..f65fbbffe90 100644 --- a/code/modules/mod/modules/modules_engineering.dm +++ b/code/modules/mod/modules/modules_engineering.dm @@ -12,13 +12,13 @@ overlay_state_inactive = "module_welding" required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_EYES|ITEM_SLOT_MASK) -/obj/item/mod/module/welding/on_suit_activation() +/obj/item/mod/module/welding/on_part_activation() var/obj/item/clothing/head_cover = mod.get_part_from_slot(ITEM_SLOT_HEAD) || mod.get_part_from_slot(ITEM_SLOT_MASK) || mod.get_part_from_slot(ITEM_SLOT_EYES) if(istype(head_cover)) //this is a screen that displays an image, so flash sensitives can use this to protect against flashes. head_cover.flash_protect = FLASH_PROTECTION_WELDER_HYPER_SENSITIVE -/obj/item/mod/module/welding/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/welding/on_part_deactivation(deleting = FALSE) if(deleting) return var/obj/item/clothing/head_cover = mod.get_part_from_slot(ITEM_SLOT_HEAD) || mod.get_part_from_slot(ITEM_SLOT_MASK) || mod.get_part_from_slot(ITEM_SLOT_EYES) @@ -244,13 +244,13 @@ target.AddComponent(/datum/component/tether, src, 7, "tether") /datum/embed_data/tether_projectile - embed_chance=65 // spiky - fall_chance=2 - ignore_throwspeed_threshold=TRUE - pain_stam_pct=0.4 - pain_mult=3 - jostle_pain_mult=2 - rip_time=1 SECONDS + embed_chance = 65 //spiky + fall_chance = 2 + ignore_throwspeed_threshold = TRUE + pain_stam_pct = 0.4 + pain_mult = 3 + jostle_pain_mult = 2 + rip_time = 1 SECONDS ///Radiation Protection - Protects the user from radiation, gives them a geiger counter and rad info in the panel. /obj/item/mod/module/rad_protection @@ -263,17 +263,18 @@ idle_power_cost = DEFAULT_CHARGE_DRAIN * 0.3 incompatible_modules = list(/obj/item/mod/module/rad_protection) tgui_id = "rad_counter" + required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_MASK, ITEM_SLOT_OCLOTHING|ITEM_SLOT_ICLOTHING, ITEM_SLOT_GLOVES, ITEM_SLOT_FEET) /// Radiation threat level being perceived. var/perceived_threat_level -/obj/item/mod/module/rad_protection/on_suit_activation() +/obj/item/mod/module/rad_protection/on_part_activation() AddComponent(/datum/component/geiger_sound) ADD_TRAIT(mod.wearer, TRAIT_BYPASS_EARLY_IRRADIATED_CHECK, MOD_TRAIT) RegisterSignal(mod.wearer, COMSIG_IN_RANGE_OF_IRRADIATION, PROC_REF(on_pre_potential_irradiation)) for(var/obj/item/part in mod.get_parts(all = TRUE)) ADD_TRAIT(part, TRAIT_RADIATION_PROTECTED_CLOTHING, MOD_TRAIT) -/obj/item/mod/module/rad_protection/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/rad_protection/on_part_deactivation(deleting = FALSE) qdel(GetComponent(/datum/component/geiger_sound)) REMOVE_TRAIT(mod.wearer, TRAIT_BYPASS_EARLY_IRRADIATED_CHECK, MOD_TRAIT) UnregisterSignal(mod.wearer, COMSIG_IN_RANGE_OF_IRRADIATION) @@ -309,10 +310,10 @@ cooldown_time = 11 SECONDS required_slots = list(ITEM_SLOT_GLOVES) -/obj/item/mod/module/constructor/on_suit_activation() +/obj/item/mod/module/constructor/on_part_activation() ADD_TRAIT(mod.wearer, TRAIT_QUICK_BUILD, MOD_TRAIT) -/obj/item/mod/module/constructor/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/constructor/on_part_deactivation(deleting = FALSE) REMOVE_TRAIT(mod.wearer, TRAIT_QUICK_BUILD, MOD_TRAIT) /obj/item/mod/module/constructor/on_use() @@ -332,10 +333,10 @@ incompatible_modules = list(/obj/item/mod/module/armor_booster, /obj/item/mod/module/infiltrator) required_slots = list(ITEM_SLOT_HEAD) -/obj/item/mod/module/headprotector/on_suit_activation() +/obj/item/mod/module/headprotector/on_part_activation() ADD_TRAIT(mod.wearer, TRAIT_HEAD_INJURY_BLOCKED, MOD_TRAIT) -/obj/item/mod/module/headprotector/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/headprotector/on_part_deactivation(deleting = FALSE) REMOVE_TRAIT(mod.wearer, TRAIT_HEAD_INJURY_BLOCKED, MOD_TRAIT) ///Mister - Sprays water over an area. diff --git a/code/modules/mod/modules/modules_general.dm b/code/modules/mod/modules/modules_general.dm index 72de7a22b49..f8efae8ea24 100644 --- a/code/modules/mod/modules/modules_general.dm +++ b/code/modules/mod/modules/modules_general.dm @@ -297,10 +297,10 @@ if("display_dna") display_dna = text2num(value) -/obj/item/mod/module/status_readout/on_suit_activation() +/obj/item/mod/module/status_readout/on_part_activation() RegisterSignal(mod.wearer, COMSIG_LIVING_DEATH, PROC_REF(death_sound)) -/obj/item/mod/module/status_readout/on_suit_deactivation(deleting) +/obj/item/mod/module/status_readout/on_part_deactivation(deleting) UnregisterSignal(mod.wearer, COMSIG_LIVING_DEATH) /obj/item/mod/module/status_readout/proc/death_sound(mob/living/carbon/human/wearer) @@ -387,10 +387,10 @@ including augmentations. However, it will take from the suit's power to do so." complexity = 2 -/obj/item/mod/module/emp_shield/advanced/on_suit_activation() +/obj/item/mod/module/emp_shield/advanced/on_part_activation() mod.wearer.AddElement(/datum/element/empprotection, EMP_PROTECT_SELF|EMP_PROTECT_CONTENTS) -/obj/item/mod/module/emp_shield/advanced/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/emp_shield/advanced/on_part_deactivation(deleting = FALSE) mod.wearer.RemoveElement(/datum/element/empprotection, EMP_PROTECT_SELF|EMP_PROTECT_CONTENTS) ///Flashlight - Gives the suit a customizable flashlight. @@ -524,10 +524,10 @@ incompatible_modules = list(/obj/item/mod/module/longfall) required_slots = list(ITEM_SLOT_FEET) -/obj/item/mod/module/longfall/on_suit_activation() +/obj/item/mod/module/longfall/on_part_activation() RegisterSignal(mod.wearer, COMSIG_LIVING_Z_IMPACT, PROC_REF(z_impact_react)) -/obj/item/mod/module/longfall/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/longfall/on_part_deactivation(deleting = FALSE) UnregisterSignal(mod.wearer, COMSIG_LIVING_Z_IMPACT) /obj/item/mod/module/longfall/proc/z_impact_react(datum/source, levels, turf/fell_on) @@ -698,13 +698,13 @@ var/former_flags var/former_visor_flags -/obj/item/mod/module/hat_stabilizer/on_suit_activation() +/obj/item/mod/module/hat_stabilizer/on_part_activation() var/obj/item/clothing/helmet = mod.get_part_from_slot(ITEM_SLOT_HEAD) if(!istype(helmet)) return helmet.AddComponent(/datum/component/hat_stabilizer) -/obj/item/mod/module/hat_stabilizer/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/hat_stabilizer/on_part_deactivation(deleting = FALSE) if(deleting) return var/obj/item/clothing/helmet = mod.get_part_from_slot(ITEM_SLOT_HEAD) @@ -733,10 +733,10 @@ incompatible_modules = list(/obj/item/mod/module/signlang_radio) required_slots = list(ITEM_SLOT_GLOVES) -/obj/item/mod/module/signlang_radio/on_suit_activation() +/obj/item/mod/module/signlang_radio/on_part_activation() ADD_TRAIT(mod.wearer, TRAIT_CAN_SIGN_ON_COMMS, MOD_TRAIT) -/obj/item/mod/module/signlang_radio/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/signlang_radio/on_part_deactivation(deleting = FALSE) REMOVE_TRAIT(mod.wearer, TRAIT_CAN_SIGN_ON_COMMS, MOD_TRAIT) ///A module that recharges the suit by an itsy tiny bit whenever the user takes a step. Originally called "magneto module" but the videogame reference sounds cooler. @@ -749,14 +749,14 @@ required_slots = list(ITEM_SLOT_FEET) var/power_per_step = DEFAULT_CHARGE_DRAIN * 0.3 -/obj/item/mod/module/joint_torsion/on_suit_activation() +/obj/item/mod/module/joint_torsion/on_part_activation() if(!(mod.wearer.movement_type & (FLOATING|FLYING))) RegisterSignal(mod.wearer, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved)) /// This way we don't even bother to call on_moved() while flying/floating RegisterSignal(mod.wearer, COMSIG_MOVETYPE_FLAG_ENABLED, PROC_REF(on_movetype_flag_enabled)) RegisterSignal(mod.wearer, COMSIG_MOVETYPE_FLAG_DISABLED, PROC_REF(on_movetype_flag_disabled)) -/obj/item/mod/module/joint_torsion/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/joint_torsion/on_part_deactivation(deleting = FALSE) UnregisterSignal(mod.wearer, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVETYPE_FLAG_ENABLED, COMSIG_MOVETYPE_FLAG_DISABLED)) /obj/item/mod/module/joint_torsion/proc/on_movetype_flag_enabled(datum/source, flag, old_state) @@ -982,7 +982,7 @@ qdel(gloves.GetComponent(/datum/component/profound_fisher)) return ..() -/obj/item/mod/module/fishing_glove/on_suit_activation() +/obj/item/mod/module/fishing_glove/on_part_activation() var/obj/item/gloves = mod.get_part_from_slot(ITEM_SLOT_GLOVES) if(!gloves) return @@ -990,7 +990,7 @@ if(equipped) gloves.AddComponent(/datum/component/profound_fisher, equipped) -/obj/item/mod/module/fishing_glove/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/fishing_glove/on_part_deactivation(deleting = FALSE) var/obj/item/gloves = mod.get_part_from_slot(ITEM_SLOT_GLOVES) if(gloves && !deleting) qdel(gloves.GetComponent(/datum/component/adjust_fishing_difficulty)) @@ -1005,12 +1005,12 @@ incompatible_modules = list(/obj/item/mod/module/shock_absorber) required_slots = list(ITEM_SLOT_BACK|ITEM_SLOT_BELT) -/obj/item/mod/module/shock_absorber/on_suit_activation() +/obj/item/mod/module/shock_absorber/on_part_activation() . = ..() ADD_TRAIT(mod.wearer, TRAIT_BATON_RESISTANCE, REF(src)) RegisterSignal(mod.wearer, COMSIG_MOB_BATONED, PROC_REF(mob_batoned)) -/obj/item/mod/module/shock_absorber/on_suit_deactivation(deleting) +/obj/item/mod/module/shock_absorber/on_part_deactivation(deleting) . = ..() REMOVE_TRAIT(mod.wearer, TRAIT_BATON_RESISTANCE, REF(src)) UnregisterSignal(mod.wearer, COMSIG_MOB_BATONED) diff --git a/code/modules/mod/modules/modules_maint.dm b/code/modules/mod/modules/modules_maint.dm index 69a2cbd87b2..24a0d2822f1 100644 --- a/code/modules/mod/modules/modules_maint.dm +++ b/code/modules/mod/modules/modules_maint.dm @@ -22,11 +22,11 @@ /obj/item/mod/module/springlock/on_uninstall(deleting = FALSE) mod.activation_step_time /= step_change -/obj/item/mod/module/springlock/on_suit_activation() +/obj/item/mod/module/springlock/on_part_activation() RegisterSignal(mod.wearer, COMSIG_ATOM_EXPOSE_REAGENTS, PROC_REF(on_wearer_exposed)) AddComponent(/datum/component/connect_loc_behalf, mod.wearer, gas_connections) -/obj/item/mod/module/springlock/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/springlock/on_part_deactivation(deleting = FALSE) UnregisterSignal(mod.wearer, COMSIG_ATOM_EXPOSE_REAGENTS) qdel(GetComponent(/datum/component/connect_loc_behalf)) diff --git a/code/modules/mod/modules/modules_medical.dm b/code/modules/mod/modules/modules_medical.dm index a0cf2408860..154717cbcc1 100644 --- a/code/modules/mod/modules/modules_medical.dm +++ b/code/modules/mod/modules/modules_medical.dm @@ -75,12 +75,12 @@ required_slots = list(ITEM_SLOT_GLOVES) var/quick_carry_trait = TRAIT_QUICK_CARRY -/obj/item/mod/module/quick_carry/on_suit_activation() +/obj/item/mod/module/quick_carry/on_part_activation() . = ..() ADD_TRAIT(mod.wearer, TRAIT_FASTMED, MOD_TRAIT) ADD_TRAIT(mod.wearer, quick_carry_trait, MOD_TRAIT) -/obj/item/mod/module/quick_carry/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/quick_carry/on_part_deactivation(deleting = FALSE) . = ..() REMOVE_TRAIT(mod.wearer, TRAIT_FASTMED, MOD_TRAIT) REMOVE_TRAIT(mod.wearer, quick_carry_trait, MOD_TRAIT) @@ -370,7 +370,7 @@ playsound(src, 'sound/items/zip/zip.ogg', 25, TRUE) balloon_alert(mod.wearer, "clothing mended") -/obj/item/mod/module/thread_ripper/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/thread_ripper/on_part_deactivation(deleting = FALSE) if(!length(ripped_clothing)) return for(var/obj/item/clothing as anything in ripped_clothing) diff --git a/code/modules/mod/modules/modules_ninja.dm b/code/modules/mod/modules/modules_ninja.dm index bce377c71e9..c4e8962c447 100644 --- a/code/modules/mod/modules/modules_ninja.dm +++ b/code/modules/mod/modules/modules_ninja.dm @@ -13,7 +13,7 @@ use_energy_cost = DEFAULT_CHARGE_DRAIN * 10 incompatible_modules = list(/obj/item/mod/module/stealth) cooldown_time = 5 SECONDS - required_slots = list(ITEM_SLOT_BACK|ITEM_SLOT_BELT) + required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_MASK, ITEM_SLOT_OCLOTHING|ITEM_SLOT_ICLOTHING, ITEM_SLOT_GLOVES, ITEM_SLOT_FEET) /// Whether or not the cloak turns off on bumping. var/bumpoff = TRUE /// The alpha applied when the cloak is on. @@ -92,11 +92,11 @@ overlay_state_inactive = null required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_EYES|ITEM_SLOT_MASK) -/obj/item/mod/module/welding/camera_vision/on_suit_activation() +/obj/item/mod/module/welding/camera_vision/on_part_activation() . = ..() RegisterSignal(mod.wearer, COMSIG_LIVING_CAN_TRACK, PROC_REF(can_track)) -/obj/item/mod/module/welding/camera_vision/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/welding/camera_vision/on_part_deactivation(deleting = FALSE) . = ..() UnregisterSignal(mod.wearer, COMSIG_LIVING_CAN_TRACK) @@ -131,10 +131,10 @@ /// How many times the module has been used to force open doors. var/door_hack_counter = 0 -/obj/item/mod/module/hacker/on_suit_activation() +/obj/item/mod/module/hacker/on_part_activation() RegisterSignal(mod.wearer, COMSIG_LIVING_UNARMED_ATTACK, PROC_REF(hack)) -/obj/item/mod/module/hacker/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/hacker/on_part_deactivation(deleting = FALSE) UnregisterSignal(mod.wearer, COMSIG_LIVING_UNARMED_ATTACK) /obj/item/mod/module/hacker/proc/hack(mob/living/carbon/human/source, atom/target, proximity, modifiers) @@ -172,10 +172,10 @@ /// The accepted typepath we can link to. var/accepted_type = /obj/item/energy_katana -/obj/item/mod/module/weapon_recall/on_suit_activation() +/obj/item/mod/module/weapon_recall/on_part_activation() mod.wearer.add_traits(list(TRAIT_NOGUNS, TRAIT_TOSS_GUN_HARD), MOD_TRAIT) -/obj/item/mod/module/weapon_recall/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/weapon_recall/on_part_deactivation(deleting = FALSE) mod.wearer.remove_traits(list(TRAIT_NOGUNS, TRAIT_TOSS_GUN_HARD), MOD_TRAIT) /obj/item/mod/module/weapon_recall/on_use() @@ -312,7 +312,7 @@ /// List of all energy nets this module made. var/list/energy_nets = list() -/obj/item/mod/module/energy_net/on_suit_deactivation(deleting) +/obj/item/mod/module/energy_net/on_part_deactivation(deleting) for(var/obj/structure/energy_net/net as anything in energy_nets) net.atom_destruction(ENERGY) diff --git a/code/modules/mod/modules/modules_security.dm b/code/modules/mod/modules/modules_security.dm index 8edcaff7715..3d1430d6dc6 100644 --- a/code/modules/mod/modules/modules_security.dm +++ b/code/modules/mod/modules/modules_security.dm @@ -36,10 +36,10 @@ return suit.allowed -= (guns_typecache - already_allowed_guns) -/obj/item/mod/module/magnetic_harness/on_suit_activation() +/obj/item/mod/module/magnetic_harness/on_part_activation() RegisterSignal(mod.wearer, COMSIG_MOB_UNEQUIPPED_ITEM, PROC_REF(check_dropped_item)) -/obj/item/mod/module/magnetic_harness/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/magnetic_harness/on_part_deactivation(deleting = FALSE) UnregisterSignal(mod.wearer, COMSIG_MOB_UNEQUIPPED_ITEM) /obj/item/mod/module/magnetic_harness/proc/check_dropped_item(datum/source, obj/item/dropped_item, force, new_location) @@ -74,10 +74,10 @@ overlay_state_use = "module_pepper_used" required_slots = list(ITEM_SLOT_OCLOTHING) -/obj/item/mod/module/pepper_shoulders/on_suit_activation() +/obj/item/mod/module/pepper_shoulders/on_part_activation() RegisterSignal(mod.wearer, COMSIG_LIVING_CHECK_BLOCK, PROC_REF(on_check_block)) -/obj/item/mod/module/pepper_shoulders/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/pepper_shoulders/on_part_deactivation(deleting = FALSE) UnregisterSignal(mod.wearer, COMSIG_LIVING_CHECK_BLOCK) /obj/item/mod/module/pepper_shoulders/on_use() @@ -387,10 +387,10 @@ for(var/i in 1 to radar_slices) sorted_creatures += list(list()) -/obj/item/mod/module/active_sonar/on_suit_activation() +/obj/item/mod/module/active_sonar/on_part_activation() RegisterSignal(mod.wearer, COMSIG_MOVABLE_MOVED, PROC_REF(sort_all_creatures)) -/obj/item/mod/module/active_sonar/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/active_sonar/on_part_deactivation(deleting = FALSE) UnregisterSignal(mod.wearer, COMSIG_MOVABLE_MOVED) /// Detects all living creatures within world.view, and returns the amount. @@ -547,10 +547,10 @@ if(!.) set_shooting_mode(SHOOTING_ASSISTANT_OFF) -/obj/item/mod/module/shooting_assistant/on_suit_activation() +/obj/item/mod/module/shooting_assistant/on_part_activation() apply_mode_effects() -/obj/item/mod/module/shooting_assistant/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/shooting_assistant/on_part_deactivation(deleting = FALSE) remove_mode_effects() /obj/item/mod/module/shooting_assistant/proc/stormtrooper_fired_gun(mob/user, obj/item/gun/gun_fired, target, params, zone_override, list/bonus_spread_values) @@ -582,10 +582,10 @@ incompatible_modules = list(/obj/item/mod/module/shove_blocker) required_slots = list(ITEM_SLOT_OCLOTHING) -/obj/item/mod/module/shove_blocker/on_suit_activation() +/obj/item/mod/module/shove_blocker/on_part_activation() mod.wearer.add_traits(list(TRAIT_BRAWLING_KNOCKDOWN_BLOCKED, TRAIT_NO_STAGGER, TRAIT_NO_THROW_HITPUSH), MOD_TRAIT) -/obj/item/mod/module/shove_blocker/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/shove_blocker/on_part_deactivation(deleting = FALSE) mod.wearer.remove_traits(list(TRAIT_BRAWLING_KNOCKDOWN_BLOCKED, TRAIT_NO_STAGGER, TRAIT_NO_THROW_HITPUSH), MOD_TRAIT) /obj/item/mod/module/shove_blocker/locked @@ -601,10 +601,10 @@ complexity = 0 required_slots = list(ITEM_SLOT_GLOVES) -/obj/item/mod/module/quick_cuff/on_suit_activation() +/obj/item/mod/module/quick_cuff/on_part_activation() . = ..() ADD_TRAIT(mod.wearer, TRAIT_FAST_CUFFING, MOD_TRAIT) -/obj/item/mod/module/quick_cuff/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/quick_cuff/on_part_deactivation(deleting = FALSE) . = ..() REMOVE_TRAIT(mod.wearer, TRAIT_FAST_CUFFING, MOD_TRAIT) diff --git a/code/modules/mod/modules/modules_service.dm b/code/modules/mod/modules/modules_service.dm index 4d2650585b1..ad559a07ccf 100644 --- a/code/modules/mod/modules/modules_service.dm +++ b/code/modules/mod/modules/modules_service.dm @@ -76,7 +76,7 @@ incompatible_modules = list(/obj/item/mod/module/waddle) required_slots = list(ITEM_SLOT_FEET) -/obj/item/mod/module/waddle/on_suit_activation() +/obj/item/mod/module/waddle/on_part_activation() var/obj/item/shoes = mod.get_part_from_slot(ITEM_SLOT_FEET) if(shoes) shoes.AddComponent(/datum/component/squeak, list('sound/effects/footstep/clownstep1.ogg'=1,'sound/effects/footstep/clownstep2.ogg'=1), 50, falloff_exponent = 20) //die off quick please @@ -84,7 +84,7 @@ if(is_clown_job(mod.wearer.mind?.assigned_role)) mod.wearer.add_mood_event("clownshoes", /datum/mood_event/clownshoes) -/obj/item/mod/module/waddle/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/waddle/on_part_deactivation(deleting = FALSE) var/obj/item/shoes = mod.get_part_from_slot(ITEM_SLOT_FEET) if(shoes && !deleting) qdel(shoes.GetComponent(/datum/component/squeak)) diff --git a/code/modules/mod/modules/modules_supply.dm b/code/modules/mod/modules/modules_supply.dm index 1ce0a2f316d..8be66e0b3e3 100644 --- a/code/modules/mod/modules/modules_supply.dm +++ b/code/modules/mod/modules/modules_supply.dm @@ -80,7 +80,7 @@ else balloon_alert(mod.wearer, "invalid target!") -/obj/item/mod/module/clamp/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/clamp/on_part_deactivation(deleting = FALSE) if(deleting) return for(var/atom/movable/crate as anything in stored_crates) @@ -275,10 +275,10 @@ . = ..() disposal_tag = pick(GLOB.TAGGERLOCATIONS) -/obj/item/mod/module/disposal_connector/on_suit_activation() +/obj/item/mod/module/disposal_connector/on_part_activation() RegisterSignal(mod.wearer, COMSIG_MOVABLE_DISPOSING, PROC_REF(disposal_handling)) -/obj/item/mod/module/disposal_connector/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/disposal_connector/on_part_deactivation(deleting = FALSE) UnregisterSignal(mod.wearer, COMSIG_MOVABLE_DISPOSING) /obj/item/mod/module/disposal_connector/get_configuration() @@ -361,7 +361,7 @@ incompatible_modules = list(/obj/item/mod/module/ash_accretion) overlay_state_inactive = "module_ash" use_mod_colors = TRUE - required_slots = list(ITEM_SLOT_OCLOTHING|ITEM_SLOT_ICLOTHING) + required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_MASK, ITEM_SLOT_OCLOTHING|ITEM_SLOT_ICLOTHING, ITEM_SLOT_GLOVES, ITEM_SLOT_FEET) /// How many tiles we can travel to max out the armor. var/max_traveled_tiles = 10 /// How many tiles we traveled through. @@ -406,11 +406,11 @@ /turf/open/water, )) -/obj/item/mod/module/ash_accretion/on_suit_activation() +/obj/item/mod/module/ash_accretion/on_part_activation() mod.wearer.add_traits(list(TRAIT_ASHSTORM_IMMUNE, TRAIT_SNOWSTORM_IMMUNE), MOD_TRAIT) RegisterSignal(mod.wearer, COMSIG_MOVABLE_MOVED, PROC_REF(on_move)) -/obj/item/mod/module/ash_accretion/on_suit_deactivation(deleting = FALSE) +/obj/item/mod/module/ash_accretion/on_part_deactivation(deleting = FALSE) mod.wearer.remove_traits(list(TRAIT_ASHSTORM_IMMUNE, TRAIT_SNOWSTORM_IMMUNE), MOD_TRAIT) UnregisterSignal(mod.wearer, COMSIG_MOVABLE_MOVED) if(!traveled_tiles) @@ -471,7 +471,7 @@ use_energy_cost = DEFAULT_CHARGE_DRAIN * 3 incompatible_modules = list(/obj/item/mod/module/sphere_transform) cooldown_time = 1.25 SECONDS - required_slots = list(ITEM_SLOT_OCLOTHING|ITEM_SLOT_ICLOTHING, ITEM_SLOT_HEAD|ITEM_SLOT_MASK) + required_slots = list(ITEM_SLOT_HEAD|ITEM_SLOT_MASK, ITEM_SLOT_OCLOTHING|ITEM_SLOT_ICLOTHING, ITEM_SLOT_GLOVES, ITEM_SLOT_FEET) /// Time it takes us to complete the animation. var/animate_time = 0.25 SECONDS /// List of traits to add/remove from our subject as needed. diff --git a/code/modules/surgery/bodyparts/dismemberment.dm b/code/modules/surgery/bodyparts/dismemberment.dm index 16f8d771c4a..f4724db3b69 100644 --- a/code/modules/surgery/bodyparts/dismemberment.dm +++ b/code/modules/surgery/bodyparts/dismemberment.dm @@ -193,14 +193,13 @@ /obj/item/bodypart/arm/drop_limb(special, dismembered, move_to_floor = TRUE) var/mob/living/carbon/arm_owner = owner - if(special || !arm_owner) return ..() - if(arm_owner.hand_bodyparts[held_index] == src) // We only want to do this if the limb being removed is the active hand part. // This catches situations where limbs are "hot-swapped" such as augmentations and roundstart prosthetics. arm_owner.dropItemToGround(arm_owner.get_item_for_held_index(held_index), 1) + . = ..() if(arm_owner.handcuffed) arm_owner.handcuffed.forceMove(drop_location()) arm_owner.handcuffed.dropped(arm_owner) @@ -209,21 +208,22 @@ if(arm_owner.hud_used) var/atom/movable/screen/inventory/hand/associated_hand = arm_owner.hud_used.hand_slots["[held_index]"] associated_hand?.update_appearance() - . = ..() if(arm_owner.num_hands == 0) - arm_owner.dropItemToGround(arm_owner.gloves, TRUE) + arm_owner.dropItemToGround(arm_owner.gloves, force = TRUE) arm_owner.update_worn_gloves() //to remove the bloody hands overlay /obj/item/bodypart/leg/drop_limb(special, dismembered, move_to_floor = TRUE) - if(owner && !special) - if(owner.legcuffed) - owner.legcuffed.forceMove(owner.drop_location()) //At this point bodypart is still in nullspace - owner.legcuffed.dropped(owner) - owner.legcuffed = null - owner.update_worn_legcuffs() - if(owner.shoes) - owner.dropItemToGround(owner.shoes, TRUE) - return ..() + var/mob/living/carbon/leg_owner = owner + . = ..() + if(special || !leg_owner) + return + if(leg_owner.legcuffed) + leg_owner.legcuffed.forceMove(drop_location()) + leg_owner.legcuffed.dropped(leg_owner) + leg_owner.legcuffed = null + leg_owner.update_worn_legcuffs() + if(leg_owner.shoes) + leg_owner.dropItemToGround(leg_owner.shoes, force = TRUE) /obj/item/bodypart/head/drop_limb(special, dismembered, move_to_floor = TRUE) if(!special) diff --git a/code/modules/unit_tests/dismemberment.dm b/code/modules/unit_tests/dismemberment.dm index d8ce43b960e..06c8707af20 100644 --- a/code/modules/unit_tests/dismemberment.dm +++ b/code/modules/unit_tests/dismemberment.dm @@ -14,7 +14,7 @@ // Abnormal situation: We're holding an undroppable item and get dismembered. ADD_TRAIT(testing_item, TRAIT_NODROP, TRAIT_GENERIC) - test_item(dummy, testing_item, status_text = "after applying TRAIT_NODROP to the testing item") + test_item(dummy, testing_item, status_text = " after applying TRAIT_NODROP to the testing item") /datum/unit_test/dismemberment/proc/test_item(mob/living/carbon/human/dummy, obj/item/testing_item, status_text = "") @@ -31,7 +31,7 @@ var/obj/item/held_item = dummy.get_item_for_held_index(dismembered_limb.held_index) dismembered_limb.dismember() - TEST_ASSERT(held_item in dummy.loc, "Dummy did not drop [held_item] when [dismembered_limb] was dismembered [status_text].") + TEST_ASSERT(held_item in dummy.loc, "Dummy did not drop [held_item] when [dismembered_limb] was dismembered[status_text].") // Clean up after ourselves qdel(dismembered_limb) dummy.fully_heal(HEAL_ALL)