From 5c2c77a4b39cba9de62db12e38620de32b3eedd9 Mon Sep 17 00:00:00 2001 From: Geeves Date: Tue, 24 Dec 2024 18:04:40 +0200 Subject: [PATCH] Loadout Modsuit Configuration (#19924) * The PMCG modsuit can now be configured inside the loadout. ![image](https://github.com/user-attachments/assets/30a5b76a-0f2f-4f6e-a6ac-084ba5932cec) --- .../loadout/items/factions.dm | 54 +++++++++++++++ code/modules/clothing/factions/pmcg.dm | 65 ++++++++++-------- .../geeves-loadout_modsuit_configuration.yml | 6 ++ .../clothing/under/uniforms/pmcg_modsuit.dmi | Bin 700 -> 723 bytes 4 files changed, 97 insertions(+), 28 deletions(-) create mode 100644 html/changelogs/geeves-loadout_modsuit_configuration.yml diff --git a/code/modules/client/preference_setup/loadout/items/factions.dm b/code/modules/client/preference_setup/loadout/items/factions.dm index db690c995eb..ef2d0fca2d3 100644 --- a/code/modules/client/preference_setup/loadout/items/factions.dm +++ b/code/modules/client/preference_setup/loadout/items/factions.dm @@ -352,6 +352,7 @@ pmcg_headwear["Grupo Amapola utility cover"] = /obj/item/clothing/head/grupo_amapola/ute gear_tweaks += new /datum/gear_tweak/path(pmcg_headwear) +// START: PMCG MODSUIT /datum/gear/faction/pmc_modsuit display_name = "PMCG modsuit" description = "A modular PMCG fatigue jumpsuit." @@ -359,6 +360,59 @@ slot = slot_w_uniform faction = "Private Military Contracting Group" +/datum/gear/faction/pmc_modsuit/New() + ..() + gear_tweaks += list(gear_tweak_modsuit_configuration) + + +var/datum/gear_tweak/modsuit_configuration/gear_tweak_modsuit_configuration = new() + +/datum/gear_tweak/modsuit_configuration + /// the configuration of the modsuit, using just a list of the names + var/list/configuration_options = list() + +/datum/gear_tweak/modsuit_configuration/get_contents(var/metadata) + return "Modsuit Configuration: [metadata]" + +/datum/gear_tweak/modsuit_configuration/get_default() + var/obj/item/clothing/under/pmc_modsuit/modsuit_type = /obj/item/clothing/under/pmc_modsuit + return initial(modsuit_type.modsuit_mode) + +/// Instantiates the modsuit item so we can set up the configuration whenever it's needed, only called when the options haven't been configured yet +/datum/gear_tweak/modsuit_configuration/proc/load_configuration_options() + // forgive me, for i have sinned. there is no way to initial() a list, so we need to instantiate the item and grab its data here + // and we can't do that in /New, cuz that fails CI. instead, we grab it on-demand here if the options aren't populated + + var/obj/item/clothing/under/pmc_modsuit/initial_uniform = new() + for(var/option in initial_uniform.configuration_options) + configuration_options |= option + qdel(initial_uniform) + +/datum/gear_tweak/modsuit_configuration/get_metadata(var/user, var/metadata, var/title = "Character Preference") + if(!length(configuration_options)) + load_configuration_options() + + var/selected_configuration = tgui_input_list(user, "How do you want your modsuit to be set up?", title, configuration_options, metadata) + if(selected_configuration) + return selected_configuration + +/datum/gear_tweak/modsuit_configuration/tweak_item(var/obj/item/clothing/under/pmc_modsuit/modsuit, var/metadata, var/mob/living/carbon/human/H) + if(!metadata) + return + + if(!length(configuration_options)) + load_configuration_options() + + // if this mode isn't in the options, don't continue, this'll protect us from old data if the mode names ever change + if(!(metadata in configuration_options)) + return + + modsuit.modsuit_mode = metadata + modsuit.selected_modsuit() + +// END: PMCG MODSUIT + + /datum/gear/faction/pmcg_sec_uniforms display_name = "PMCG/EPMC security uniform selection" description = "A selection of PMCG and EPMC security uniforms." diff --git a/code/modules/clothing/factions/pmcg.dm b/code/modules/clothing/factions/pmcg.dm index c734f800b85..71eade5b044 100644 --- a/code/modules/clothing/factions/pmcg.dm +++ b/code/modules/clothing/factions/pmcg.dm @@ -1,3 +1,8 @@ +#define MODSUIT_REGULAR "Regular" +#define MODSUIT_SHORTSLEEVE "Shortsleeve" +#define MODSUIT_PANTS "Pants" +#define MODSUIT_SHORTS "Shorts" + // PMCG Modsuit /obj/item/clothing/under/pmc_modsuit name = "\improper PMCG modsuit" @@ -10,47 +15,46 @@ item_state = "pmcg_modsuit" contained_sprite = TRUE action_button_name = "Change Modsuit" - var/modsuit_mode = 0 - var/list/names = list( - "\improper PMCG modsuit", - "\improper PMCG shortsleeved modsuit", - "\improper PMCG modsuit pants", - "\improper PMCG shorts modsuit") + + /// The current display mode of the modsuit + var/modsuit_mode = MODSUIT_REGULAR + + /// The possible options the modsuit can be configured into, it's a key value list which get populated in Initialize, the key is the name of the mode, while the value is the icon for the radial menu + var/list/configuration_options = list( + MODSUIT_REGULAR, + MODSUIT_SHORTSLEEVE, + MODSUIT_PANTS, + MODSUIT_SHORTS + ) /obj/item/clothing/under/pmc_modsuit/Initialize() - for(var/option in names) - if(!modsuit_mode) - names[option] = image('icons/clothing/under/uniforms/pmcg_modsuit.dmi', icon_state) - modsuit_mode = 1 - else - names[option] = image('icons/clothing/under/uniforms/pmcg_modsuit.dmi', initial(icon_state) + "_[names.Find(option) - 1]") - modsuit_mode = 0 - .=..() + . = ..() + for(var/option in configuration_options) + configuration_options[option] = image('icons/clothing/under/uniforms/pmcg_modsuit.dmi', initial(icon_state) + "_" + option) + +/obj/item/clothing/under/pmc_modsuit/get_examine_text(mob/user, distance, is_adjacent, infix, suffix) + . = ..() + . += SPAN_NOTICE("It's currently in the [SPAN_BOLD("[modsuit_mode]")] configuration.") /obj/item/clothing/under/pmc_modsuit/attack_self(mob/user) select_modsuit(user) +/// Opens the radial menu to let the user select their modsuit configuration /obj/item/clothing/under/pmc_modsuit/proc/select_modsuit(mob/user) - var/modsuit_choice = RADIAL_INPUT(user, names) + var/modsuit_choice = RADIAL_INPUT(user, configuration_options) if(!modsuit_choice) return - modsuit_mode = names.Find(modsuit_choice) - 1 + modsuit_mode = modsuit_choice selected_modsuit(user) - update_clothing_icon() - -/obj/item/clothing/under/pmc_modsuit/proc/selected_modsuit(mob/user as mob) - if(!modsuit_mode) - name = initial(name) - icon_state = initial(icon_state) - item_state = initial(item_state) - else - name = names[modsuit_mode + 1] - icon_state = initial(icon_state) + "_[modsuit_mode]" - item_state = initial(item_state) + "_[modsuit_mode]" +/// Updates the clothing icon with the new modsuit_mode +/obj/item/clothing/under/pmc_modsuit/proc/selected_modsuit(mob/user) + icon_state = initial(icon_state) + "_[modsuit_mode]" + item_state = initial(item_state) + "_[modsuit_mode]" update_clothing_icon() - user.update_action_buttons() + if(user) + user.update_action_buttons() /obj/item/clothing/under/pmc_modsuit/verb/change_modsuit() set name = "Change Modsuit" @@ -61,6 +65,11 @@ select_modsuit(usr) +#undef MODSUIT_REGULAR +#undef MODSUIT_SHORTSLEEVE +#undef MODSUIT_PANTS +#undef MODSUIT_SHORTS + /obj/item/clothing/under/rank/security/pmc/wildlands_squadron name = "wildlands squadron uniform" desc = "A set of uniform fatigues used by employees of the Wildlands Squadron, a Private Military Contracting Group subsidiary. The original design is remarkably similar to the Mictlan System Defense Force's uniform, of which many of the original members of the Wildlands Squadron were members." diff --git a/html/changelogs/geeves-loadout_modsuit_configuration.yml b/html/changelogs/geeves-loadout_modsuit_configuration.yml new file mode 100644 index 00000000000..e594a1c9d75 --- /dev/null +++ b/html/changelogs/geeves-loadout_modsuit_configuration.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "The PMCG modsuit can now be configured inside the loadout." diff --git a/icons/clothing/under/uniforms/pmcg_modsuit.dmi b/icons/clothing/under/uniforms/pmcg_modsuit.dmi index a0c35c827e382f641798c1bfe8eb283b4f294ade..bf5a974fb336f7e41a8b72525b6e31090caecb2d 100644 GIT binary patch delta 106 zcmV-w0G0o|1=9tPSOKPySyWmiJ}5Q4G$*l0iHkEOv#1y-ZOFx$R+N~V3Sr~b6knQ$ z&}Tw~zTk}fqLSjA)YP(6(kw*MNV25?iFqZ(q*({nLZV}Y`QtDg%v!T|mfg)hA6royua0n7oyHzS7t