diff --git a/code/__DEFINES/mod.dm b/code/__DEFINES/mod.dm index 1a4bed1ca99..dcfcf028d08 100644 --- a/code/__DEFINES/mod.dm +++ b/code/__DEFINES/mod.dm @@ -57,5 +57,9 @@ /// Global list of all /datum/mod_theme GLOBAL_LIST_INIT(mod_themes, setup_mod_themes()) +/// Global cache of mod skins to masks per different configuration of pulled out parts. +GLOBAL_LIST_EMPTY(mod_masks) +/// Global cache of mod skins to deployed parts to module icon states +GLOBAL_LIST_EMPTY(mod_module_overlays) /// Global list of all ids associated to a /datum/mod_link instance GLOBAL_LIST_EMPTY(mod_link_ids) diff --git a/code/modules/mod/mod_activation.dm b/code/modules/mod/mod_activation.dm index a9a793d8a2f..a8ac2474142 100644 --- a/code/modules/mod/mod_activation.dm +++ b/code/modules/mod/mod_activation.dm @@ -226,7 +226,8 @@ part.heat_protection = NONE part.cold_protection = NONE part.alternate_worn_layer = part_datum.unsealed_layer - wearer.update_clothing(part.slot_flags) + generate_suit_mask() + wearer.update_clothing(part.slot_flags | slot_flags) wearer.update_obscured_slots(part.visor_flags_inv) if((part.clothing_flags & (MASKINTERNALS|HEADINTERNALS)) && wearer.invalid_internals()) wearer.cutoff_internals() @@ -263,8 +264,9 @@ continue module.on_suit_deactivation() update_speed() - update_appearance(UPDATE_ICON_STATE) update_charge_alert() + update_appearance(UPDATE_ICON_STATE) + generate_suit_mask() wearer.update_clothing(slot_flags) /// Quickly deploys all the suit parts and if successful, seals them and turns on the suit. Intended mostly for outfits. diff --git a/code/modules/mod/mod_control.dm b/code/modules/mod/mod_control.dm index 21bf8509d6b..18ecd44c3e7 100644 --- a/code/modules/mod/mod_control.dm +++ b/code/modules/mod/mod_control.dm @@ -475,6 +475,30 @@ wearer.update_spacesuit_hud_icon("0") wearer = null +/obj/item/mod/control/proc/get_sealed_slots(list/parts) + var/covered_slots = NONE + for(var/obj/item/part as anything in parts) + if(!get_part_datum(part).sealed) + parts -= part + continue + covered_slots |= part.slot_flags + return covered_slots + +/obj/item/mod/control/proc/generate_suit_mask() + var/list/parts = get_parts(all = TRUE) + var/covered_slots = get_sealed_slots(parts) + if(GLOB.mod_masks[skin]) + if(GLOB.mod_masks[skin]["[covered_slots]"]) + return GLOB.mod_masks[skin]["[covered_slots]"] + else + GLOB.mod_masks[skin] = list() + var/icon/slot_mask = icon('icons/blanks/32x32.dmi', "nothing") + for(var/obj/item/part as anything in parts) + slot_mask.Blend(icon(part.worn_icon, part.icon_state), ICON_OVERLAY) + slot_mask.Blend("#fff", ICON_ADD) + GLOB.mod_masks[skin]["[covered_slots]"] = slot_mask + return GLOB.mod_masks[skin]["[covered_slots]"] + /obj/item/mod/control/proc/clean_up() if(QDELING(src)) unset_wearer() diff --git a/code/modules/mod/modules/_module.dm b/code/modules/mod/modules/_module.dm index 3055d0616f9..ad0ca106bd1 100644 --- a/code/modules/mod/modules/_module.dm +++ b/code/modules/mod/modules/_module.dm @@ -45,6 +45,8 @@ var/allow_flags = NONE /// A list of slots required in the suit to work. Formatted like list(x|y, z, ...) where either x or y are required and z is required. var/list/required_slots = list() + /// If TRUE worn overlay will be masked with the suit, preventing any bits from poking out of its controur + var/mask_worn_overlay = FALSE /// Timer for the cooldown COOLDOWN_DECLARE(cooldown_timer) @@ -335,23 +337,47 @@ /// 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) + if(!mod.active || !has_required_parts(mod.mod_parts, need_extended = TRUE)) return - var/used_overlay - if(overlay_state_use && !COOLDOWN_FINISHED(src, cooldown_timer)) - used_overlay = overlay_state_use - else if(overlay_state_active && active) - used_overlay = overlay_state_active - else if(overlay_state_inactive) - used_overlay = overlay_state_inactive + var/used_overlay = get_current_overlay_state() + if (!used_overlay) + return + var/mutable_appearance/module_icon + if(mask_worn_overlay) + module_icon = mutable_appearance(get_module_icon_cache(used_overlay), layer = standing.layer + 0.1) else - return - var/mutable_appearance/module_icon = mutable_appearance(overlay_icon_file, used_overlay, layer = standing.layer + 0.1) + module_icon = mutable_appearance(overlay_icon_file, used_overlay, layer = standing.layer + 0.1) if(!use_mod_colors) module_icon.appearance_flags |= RESET_COLOR + . += module_icon SEND_SIGNAL(src, COMSIG_MODULE_GENERATE_WORN_OVERLAY, ., standing) +/obj/item/mod/module/proc/get_current_overlay_state() + if(overlay_state_use && !COOLDOWN_FINISHED(src, cooldown_timer)) + return overlay_state_use + if(overlay_state_active && active) + return overlay_state_active + if(overlay_state_inactive) + return overlay_state_inactive + return null + +/obj/item/mod/module/proc/get_module_icon_cache(used_overlay) + var/covered_slots = mod.get_sealed_slots(mod.get_parts(all = TRUE)) + if (GLOB.mod_module_overlays[mod.skin]) + if (GLOB.mod_module_overlays[mod.skin]["[covered_slots]"]) + if (GLOB.mod_module_overlays[mod.skin]["[covered_slots]"][used_overlay]) + return GLOB.mod_module_overlays[mod.skin]["[covered_slots]"][used_overlay] + else + GLOB.mod_module_overlays[mod.skin]["[covered_slots]"] = list() + else + GLOB.mod_module_overlays[mod.skin] = list() + GLOB.mod_module_overlays[mod.skin]["[covered_slots]"] = list() + var/icon/mod_mask = icon(mod.generate_suit_mask()) + mod_mask.Blend(icon(overlay_icon_file, used_overlay), ICON_MULTIPLY) + GLOB.mod_module_overlays[mod.skin]["[covered_slots]"][used_overlay] = mod_mask + return GLOB.mod_module_overlays[mod.skin]["[covered_slots]"][used_overlay] + /// Updates the signal used by active modules to be activated /obj/item/mod/module/proc/update_signal(value) switch(value) diff --git a/code/modules/mod/modules/modules_antag.dm b/code/modules/mod/modules/modules_antag.dm index 8fa2670c760..281b4239d60 100644 --- a/code/modules/mod/modules/modules_antag.dm +++ b/code/modules/mod/modules/modules_antag.dm @@ -16,6 +16,7 @@ overlay_state_inactive = "module_armorbooster_off" overlay_state_active = "module_armorbooster_on" use_mod_colors = TRUE + mask_worn_overlay = TRUE /// Whether or not this module removes pressure protection. var/remove_pressure_protection = TRUE /// Speed added to the control unit. @@ -213,6 +214,7 @@ removable = FALSE incompatible_modules = list(/obj/item/mod/module/insignia) overlay_state_inactive = "module_insignia" + mask_worn_overlay = TRUE /obj/item/mod/module/insignia/generate_worn_overlay(mutable_appearance/standing) overlay_state_inactive = "[initial(overlay_state_inactive)]-[mod.skin]" @@ -266,6 +268,7 @@ //Bite of 87 Springlock - Equips faster, disguised as DNA lock. /obj/item/mod/module/springlock/bite_of_87 + step_change = 0.1 /obj/item/mod/module/springlock/bite_of_87/Initialize(mapload) . = ..() @@ -276,12 +279,6 @@ 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_install() - mod.activation_step_time *= 0.1 - -/obj/item/mod/module/springlock/bite_of_87/on_uninstall(deleting = FALSE) - mod.activation_step_time *= 10 - /obj/item/mod/module/springlock/bite_of_87/on_suit_activation() ..() if(check_holidays(APRIL_FOOLS) || prob(1)) diff --git a/code/modules/mod/modules/modules_maint.dm b/code/modules/mod/modules/modules_maint.dm index d2f1ceaef74..69a2cbd87b2 100644 --- a/code/modules/mod/modules/modules_maint.dm +++ b/code/modules/mod/modules/modules_maint.dm @@ -14,12 +14,13 @@ var/static/list/gas_connections = list( COMSIG_TURF_EXPOSE = PROC_REF(on_wearer_exposed_gas), ) + var/step_change = 0.5 /obj/item/mod/module/springlock/on_install() - mod.activation_step_time *= 0.5 + mod.activation_step_time *= step_change /obj/item/mod/module/springlock/on_uninstall(deleting = FALSE) - mod.activation_step_time *= 2 + mod.activation_step_time /= step_change /obj/item/mod/module/springlock/on_suit_activation() RegisterSignal(mod.wearer, COMSIG_ATOM_EXPOSE_REAGENTS, PROC_REF(on_wearer_exposed)) diff --git a/icons/mob/clothing/modsuit/mod_clothing.dmi b/icons/mob/clothing/modsuit/mod_clothing.dmi index 071db6ba93c..815983f7094 100644 Binary files a/icons/mob/clothing/modsuit/mod_clothing.dmi and b/icons/mob/clothing/modsuit/mod_clothing.dmi differ diff --git a/icons/mob/clothing/modsuit/mod_modules.dmi b/icons/mob/clothing/modsuit/mod_modules.dmi index 5c433defa07..3c68a87d549 100644 Binary files a/icons/mob/clothing/modsuit/mod_modules.dmi and b/icons/mob/clothing/modsuit/mod_modules.dmi differ