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)
This commit is contained in:
Geeves
2024-12-24 16:04:40 +00:00
committed by GitHub
parent acb227f24e
commit 5c2c77a4b3
4 changed files with 97 additions and 28 deletions
@@ -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."
+37 -28
View File
@@ -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."