From a45a6c37b4dafff5da83f1de975513f0dd9a6880 Mon Sep 17 00:00:00 2001 From: Danny Kay Date: Tue, 20 Aug 2024 19:46:28 -0700 Subject: [PATCH] chore: Add support for custom color in loadout items --- code/__DEFINES/loadout.dm | 2 ++ code/controllers/subsystem/job.dm | 3 +++ code/modules/client/preferences.dm | 26 ++++++++++++++++++- .../code/modules/client/loadout/_loadout.dm | 2 +- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/loadout.dm b/code/__DEFINES/loadout.dm index 64fbb48aaf..2245767987 100644 --- a/code/__DEFINES/loadout.dm +++ b/code/__DEFINES/loadout.dm @@ -112,10 +112,12 @@ #define LOADOUT_COLOR "loadout_color" #define LOADOUT_CUSTOM_NAME "loadout_custom_name" #define LOADOUT_CUSTOM_DESCRIPTION "loadout_custom_description" +#define LOADOUT_CUSTOM_COLOR "loadout_custom_description" //loadout item flags #define LOADOUT_CAN_NAME (1<<0) //renaming items #define LOADOUT_CAN_DESCRIPTION (1<<1) //adding a custom description to items +#define LOADOUT_CAN_COLOR (1<<2) //adding a custom dick to ur butt //quirks #define QUIRK_POSITIVE "Positive" diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 077f23d1e6..9db8c50cac 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -743,6 +743,9 @@ SUBSYSTEM_DEF(job) if(i[LOADOUT_CUSTOM_DESCRIPTION]) var/custom_description = i[LOADOUT_CUSTOM_DESCRIPTION] I.desc = custom_description + if(i[LOADOUT_CUSTOM_COLOR]) + var/custom_cllor = i[LOADOUT_CUSTOM_COLOR] + I.color = "[custom_cllor]" var/displace_me = FALSE if(G.slot in displaceables) /// mm yes, displace me in my G.slot~ displace_me = TRUE diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index d4e7c3bedd..ebc1ec1316 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1663,6 +1663,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) extra_loadout_data += "
Name [loadout_item[LOADOUT_CUSTOM_NAME] ? loadout_item[LOADOUT_CUSTOM_NAME] : "N/A"]" if(gear.loadout_flags & LOADOUT_CAN_DESCRIPTION) extra_loadout_data += "
Description" + if(gear.loadout_flags & LOADOUT_CAN_COLOR) + extra_loadout_data += "
Color    " else if((gear_points - gear.cost) < 0) class_link = "style='white-space:normal;' class='linkOff'" else if(donoritem) @@ -4336,7 +4338,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) else loadout_data["SAVE_[loadout_slot]"] = list(new_loadout_data) //double packed because you somehow had no save slot in your loadout? - if(href_list["loadout_color"] || href_list["loadout_rename"] || href_list["loadout_redescribe"]) + if(href_list["loadout_color"] || href_list["loadout_rename"] || href_list["loadout_redescribe"] || href_list["loadout_recolor"]) //if the gear doesn't exist, or they don't have it, ignore the request var/name = html_decode(href_list["loadout_gear_name"]) var/datum/gear/G = GLOB.loadout_items[gear_category][gear_subcategory][name] @@ -4363,6 +4365,28 @@ GLOBAL_LIST_EMPTY(preferences_datums) if(new_description) user_gear[LOADOUT_CUSTOM_DESCRIPTION] = new_description + if(href_list["loadout_recolor"] && (G.loadout_flags & LOADOUT_CAN_COLOR)) + // var/enter_the_matrix = alert( + // user, + // "Use the simple Color Picker to choose a solid color, or use the more advanced (and convoluted) Color Matrix editor to recolor this?", + // "Colorize, Quick or Advanced?", + // "Color Picker", + // "Matrix Editor", + // "Cancel", + // ) + // if(enter_the_matrix == "Color Picker") + var/new_color = input( + user, + "Pick a cool new color for your [G.name]! =3", + "Recolor Your Thing", + user_gear[LOADOUT_CUSTOM_COLOR] || "#FFFFFF", + ) as color|null + if(new_color) + user_gear[LOADOUT_CUSTOM_COLOR] = "#[sanitize_hexcolor(new_color, 6)]" + to_chat(user, span_notice("Your [G.name] has been recolored to [user_gear[LOADOUT_CUSTOM_COLOR]]!")) + // else if(enter_the_matrix == "Matrix Editor") + // gear_color_matrix_setup_thing(user, user_gear, G) + ShowChoices(user) return 1 diff --git a/modular_citadel/code/modules/client/loadout/_loadout.dm b/modular_citadel/code/modules/client/loadout/_loadout.dm index 086c34e655..2ce4db1c19 100644 --- a/modular_citadel/code/modules/client/loadout/_loadout.dm +++ b/modular_citadel/code/modules/client/loadout/_loadout.dm @@ -53,7 +53,7 @@ GLOBAL_LIST_EMPTY(loadout_whitelist_ids) var/path //item-to-spawn path var/cost = 1 //normally, each loadout costs a single point. var/geargroupID //defines the ID that the gear inherits from the config - var/loadout_flags = LOADOUT_CAN_NAME | LOADOUT_CAN_DESCRIPTION + var/loadout_flags = LOADOUT_CAN_NAME | LOADOUT_CAN_DESCRIPTION | LOADOUT_CAN_COLOR //flags for the loadout system //NEW DONATOR SYTSEM STUFF var/donoritem //autoset on new if null