diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 2b6b262395..60b8e1565e 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -46,6 +46,17 @@ //Add a "exclude" string to do the opposite, making it only only species listed that can't wear it. //You append this to clothing objects. + //Polychrome stuff: + var/hasprimary = FALSE //These vars allow you to choose which overlays a clothing has + var/hassecondary = FALSE + var/hastertiary = FALSE + var/primary_color = "#FFFFFF" //RGB in hexcode + var/secondary_color = "#FFFFFF" + var/tertiary_color = "#808080" + + //No idea what this is but eh -tori + var/force_alternate_icon = FALSE + /obj/item/clothing/Initialize() . = ..() @@ -53,6 +64,8 @@ actions_types += /datum/action/item_action/toggle_voice_box if(ispath(pocket_storage_component_path)) LoadComponent(pocket_storage_component_path) + if(hasprimary | hassecondary | hastertiary) //Checks if polychrome is enabled + update_icon() //Applies the overlays and default colors onto the clothes on spawn. /obj/item/clothing/MouseDrop(atom/over_object) . = ..() @@ -137,6 +150,8 @@ how_cool_are_your_threads += "Adding or removing items from [src] makes no noise.\n" how_cool_are_your_threads += "" . += how_cool_are_your_threads.Join() + if(hasprimary | hassecondary | hastertiary) //Checks if polychrome is enabled + . += "Alt-click to recolor it." /obj/item/clothing/obj_break(damage_flag) if(!damaged_clothes) @@ -259,8 +274,31 @@ BLIND // can't see anything remove_accessory(user) else rolldown() + // Polychrome stuff: + if(hasprimary | hassecondary | hastertiary) + var/choice = input(user,"polychromic thread options", "Clothing Recolor") as null|anything in list("[hasprimary ? "Primary Color" : ""]", "[hassecondary ? "Secondary Color" : ""]", "[hastertiary ? "Tertiary Color" : ""]") //generates a list depending on the enabled overlays + switch(choice) //Lets the list's options actually lead to something + if("Primary Color") + var/primary_color_input = input(usr,"","Choose Primary Color",primary_color) as color|null //color input menu, the "|null" adds a cancel button to it. + if(primary_color_input) //Checks if the color selected is NULL, rejects it if it is NULL. + primary_color = sanitize_hexcolor(primary_color_input, desired_format=6, include_crunch=1) //formats the selected color properly + update_icon() //updates the item icon + user.regenerate_icons() //updates the worn icon. Probably a bad idea, but it works. + if("Secondary Color") + var/secondary_color_input = input(usr,"","Choose Secondary Color",secondary_color) as color|null + if(secondary_color_input) + secondary_color = sanitize_hexcolor(secondary_color_input, desired_format=6, include_crunch=1) + update_icon() + user.regenerate_icons() + if("Tertiary Color") + var/tertiary_color_input = input(usr,"","Choose Tertiary Color",tertiary_color) as color|null + if(tertiary_color_input) + tertiary_color = sanitize_hexcolor(tertiary_color_input, desired_format=6, include_crunch=1) + update_icon() + user.regenerate_icons() return TRUE + /obj/item/clothing/under/verb/jumpsuit_adjust() set name = "Adjust Jumpsuit Style" set category = null @@ -376,3 +414,18 @@ BLIND // can't see anything return FALSE return TRUE + +/obj/item/clothing/update_icon() // Polychrome stuff + ..() + if(hasprimary) //Checks if the overlay is enabled + var/mutable_appearance/primary_overlay = mutable_appearance(icon, "[item_color]-primary") //Automagically picks overlays + primary_overlay.color = primary_color //Colors the greyscaled overlay + add_overlay(primary_overlay) //Applies the coloured overlay onto the item sprite. but NOT the mob sprite. + if(hassecondary) + var/mutable_appearance/secondary_overlay = mutable_appearance(icon, "[item_color]-secondary") + secondary_overlay.color = secondary_color + add_overlay(secondary_overlay) + if(hastertiary) + var/mutable_appearance/tertiary_overlay = mutable_appearance(icon, "[item_color]-tertiary") + tertiary_overlay.color = tertiary_color + add_overlay(tertiary_overlay) \ No newline at end of file diff --git a/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm b/code/modules/clothing/under/polychromic_clothes.dm similarity index 86% rename from modular_citadel/code/modules/clothing/under/polychromic_clothes.dm rename to code/modules/clothing/under/polychromic_clothes.dm index c0f7a5d639..9649d93eed 100644 --- a/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm +++ b/code/modules/clothing/under/polychromic_clothes.dm @@ -4,7 +4,7 @@ // Polychromic clothes simply consist of 4 sprites: A base, unrecoloured sprite, and up to 3 greyscaled sprites. // // In order to add more polychromic clothes, simply create a base sprite, and up to 3 recolourable overlays for it, // // and then name them as follows: [name], [name]-primary, [name]-secondary, [name]-tertiary. The sprites should // -// ideally be in 'modular_citadel/icons/polyclothes/item/uniform.dmi' and 'modular_citadel/icons/polyclothes/mob/uniform.dmi' for the // +// ideally be in 'icons/obj/clothing/uniform.dmi' and 'icons/mob/uniform.dmi' for the // // worn sprites. After that, copy paste the code from any of the example clothes and // // change the names around. [name] should go in BOTH icon_state and item_color. You can preset colors and disable // // any overlays using the self-explainatory vars. // @@ -15,8 +15,6 @@ /obj/item/clothing/under/polychromic //enables all three overlays to reduce copypasta and defines basic stuff name = "polychromic suit" desc = "For when you want to show off your horrible colour coordination skills." - icon = 'modular_citadel/icons/polyclothes/item/uniform.dmi' - alternate_worn_icon = 'modular_citadel/icons/polyclothes/mob/uniform.dmi' icon_state = "polysuit" item_color = "polysuit" item_state = "sl_suit" @@ -27,23 +25,22 @@ secondary_color = "#FFFFFF" tertiary_color = "#808080" can_adjust = FALSE - mutantrace_variation = NO_MUTANTRACE_VARIATION // because I'm too lazy to port these to digi-compatible and to prove a point from /tg/ whining - Pooj - suit_style = NORMAL_SUIT_STYLE + mutantrace_variation = NO_MUTANTRACE_VARIATION //Not all clothes are currently digi-compatible (only the shorts are as of time of writing) -/obj/item/clothing/under/polychromic/worn_overlays(isinhands, icon_file) //this is where the main magic happens. Also mandates that ALL polychromic stuff MUST USE alternate_worn_icon +/obj/item/clothing/under/polychromic/worn_overlays(isinhands, icon_file) //this is where the main magic happens. . = ..() if(hasprimary | hassecondary | hastertiary) if(!isinhands) //prevents the worn sprites from showing up if you're just holding them if(hasprimary) //checks if overlays are enabled - var/mutable_appearance/primary_worn = mutable_appearance(alternate_worn_icon, "[item_color]-primary") //automagical sprite selection + var/mutable_appearance/primary_worn = mutable_appearance(icon_file, "[item_color]-primary") //automagical sprite selection primary_worn.color = primary_color //colors the overlay . += primary_worn //adds the overlay onto the buffer list to draw on the mob sprite. if(hassecondary) - var/mutable_appearance/secondary_worn = mutable_appearance(alternate_worn_icon, "[item_color]-secondary") + var/mutable_appearance/secondary_worn = mutable_appearance(icon_file, "[item_color]-secondary") secondary_worn.color = secondary_color . += secondary_worn if(hastertiary) - var/mutable_appearance/tertiary_worn = mutable_appearance(alternate_worn_icon, "[item_color]-tertiary") + var/mutable_appearance/tertiary_worn = mutable_appearance(icon_file, "[item_color]-tertiary") tertiary_worn.color = tertiary_color . += tertiary_worn @@ -89,6 +86,7 @@ secondary_color = "#808080" tertiary_color = "#808080" body_parts_covered = CHEST|GROIN|ARMS + mutantrace_variation = MUTANTRACE_VARIATION //to enable digitigrade wearing /obj/item/clothing/under/polychromic/jumpsuit name = "polychromic tri-tone jumpsuit" diff --git a/icons/mob/uniform.dmi b/icons/mob/uniform.dmi index 0f962591a5..c5981b06a3 100644 Binary files a/icons/mob/uniform.dmi and b/icons/mob/uniform.dmi differ diff --git a/icons/mob/uniform_digi.dmi b/icons/mob/uniform_digi.dmi index 94d9f07e10..b4f3e6130b 100644 Binary files a/icons/mob/uniform_digi.dmi and b/icons/mob/uniform_digi.dmi differ diff --git a/icons/obj/clothing/uniforms.dmi b/icons/obj/clothing/uniforms.dmi index 43162f2b7e..60753839d2 100644 Binary files a/icons/obj/clothing/uniforms.dmi and b/icons/obj/clothing/uniforms.dmi differ diff --git a/modular_citadel/code/modules/clothing/clothing.dm b/modular_citadel/code/modules/clothing/clothing.dm deleted file mode 100644 index 843b7a84c9..0000000000 --- a/modular_citadel/code/modules/clothing/clothing.dm +++ /dev/null @@ -1,91 +0,0 @@ -/* // -// GLOBALIZED POLYCHROME FOR ALL CLOTHING // -// // -// NOTICE: POLYCHROME STUFF MUST USE ALTERNATE_WORN_ICON AND PLACE THEIR OVERLAYS IN BOTH THE ICON AND ALTERNATE_WORN_ICON // -// // -*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -// COPYPASTE THE FOLLOWING PROC TO WHATEVER CATERGORY OF CLOTHING YOU WANT TO POLYCHROME - -// THIS IS REQUIRED DUE TO EACH CLOTHING CATEGORY HAVING A SNOWFLAKE WORN_OVERLAYS() THING - -// Don't forget to append the appropriate typepath! Also, refer to polychromic_clothes.dm for example implementations - -/* -/obj/item/clothing/worn_overlays(isinhands, icon_file) //this is where the main magic happens. Also mandates that ALL polychromic stuff MUST USE alternate_worn_icon - . = ..() - if(hasprimary | hassecondary | hastertiary) - if(!isinhands) //prevents the worn sprites from showing up if you're just holding them - if(hasprimary) //checks if overlays are enabled - var/mutable_appearance/primary_worn = mutable_appearance(alternate_worn_icon, "[item_color]-primary") //automagical sprite selection - primary_worn.color = primary_color //colors the overlay - . += primary_worn //adds the overlay onto the buffer list to draw on the mob sprite. - if(hassecondary) - var/mutable_appearance/secondary_worn = mutable_appearance(alternate_worn_icon, "[item_color]-secondary") - secondary_worn.color = secondary_color - . += secondary_worn - if(hastertiary) - var/mutable_appearance/tertiary_worn = mutable_appearance(alternate_worn_icon, "[item_color]-tertiary") - tertiary_worn.color = tertiary_color - . += tertiary_worn -*/ - -/obj/item/clothing/ - var/hasprimary = FALSE //These vars allow you to choose which overlays a clothing has - var/hassecondary = FALSE - var/hastertiary = FALSE - var/primary_color = "#FFFFFF" //RGB in hexcode - var/secondary_color = "#FFFFFF" - var/tertiary_color = "#808080" - - var/force_alternate_icon = FALSE - -/obj/item/clothing/update_icon() // picks the colored overlays from the ICON file - ..() - if(hasprimary) //Checks if the overlay is enabled - var/mutable_appearance/primary_overlay = mutable_appearance(icon, "[item_color]-primary") //Automagically picks overlays - primary_overlay.color = primary_color //Colors the greyscaled overlay - add_overlay(primary_overlay) //Applies the coloured overlay onto the item sprite. but NOT the mob sprite. - if(hassecondary) - var/mutable_appearance/secondary_overlay = mutable_appearance(icon, "[item_color]-secondary") - secondary_overlay.color = secondary_color - add_overlay(secondary_overlay) - if(hastertiary) - var/mutable_appearance/tertiary_overlay = mutable_appearance(icon, "[item_color]-tertiary") - tertiary_overlay.color = tertiary_color - add_overlay(tertiary_overlay) - -/obj/item/clothing/AltClick(mob/living/user) - . = ..() - if(hasprimary | hassecondary | hastertiary) - var/choice = input(user,"polychromic thread options", "Clothing Recolor") as null|anything in list("[hasprimary ? "Primary Color" : ""]", "[hassecondary ? "Secondary Color" : ""]", "[hastertiary ? "Tertiary Color" : ""]") //generates a list depending on the enabled overlays - switch(choice) //Lets the list's options actually lead to something - if("Primary Color") - var/primary_color_input = input(usr,"","Choose Primary Color",primary_color) as color|null //color input menu, the "|null" adds a cancel button to it. - if(primary_color_input) //Checks if the color selected is NULL, rejects it if it is NULL. - primary_color = sanitize_hexcolor(primary_color_input, desired_format=6, include_crunch=1) //formats the selected color properly - update_icon() //updates the item icon - user.regenerate_icons() //updates the worn icon. Probably a bad idea, but it works. - if("Secondary Color") - var/secondary_color_input = input(usr,"","Choose Secondary Color",secondary_color) as color|null - if(secondary_color_input) - secondary_color = sanitize_hexcolor(secondary_color_input, desired_format=6, include_crunch=1) - update_icon() - user.regenerate_icons() - if("Tertiary Color") - var/tertiary_color_input = input(usr,"","Choose Tertiary Color",tertiary_color) as color|null - if(tertiary_color_input) - tertiary_color = sanitize_hexcolor(tertiary_color_input, desired_format=6, include_crunch=1) - update_icon() - user.regenerate_icons() - return TRUE - -/obj/item/clothing/examine(mob/user) - . = ..() - if(hasprimary | hassecondary | hastertiary) - . += "Alt-click to recolor it." - -/obj/item/clothing/Initialize() - ..() - if(hasprimary | hassecondary | hastertiary) - update_icon() //Applies the overlays and default colors onto the clothes on spawn. \ No newline at end of file diff --git a/modular_citadel/icons/polyclothes/item/uniform.dmi b/modular_citadel/icons/polyclothes/item/uniform.dmi deleted file mode 100644 index 87c3479a6a..0000000000 Binary files a/modular_citadel/icons/polyclothes/item/uniform.dmi and /dev/null differ diff --git a/modular_citadel/icons/polyclothes/mob/uniform.dmi b/modular_citadel/icons/polyclothes/mob/uniform.dmi deleted file mode 100644 index 15b5262bab..0000000000 Binary files a/modular_citadel/icons/polyclothes/mob/uniform.dmi and /dev/null differ diff --git a/tgstation.dme b/tgstation.dme index 7a1b6cb890..25b7c3e6f3 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1664,6 +1664,7 @@ #include "code\modules\clothing\under\color.dm" #include "code\modules\clothing\under\miscellaneous.dm" #include "code\modules\clothing\under\pants.dm" +#include "code\modules\clothing\under\polychromic_clothes.dm" #include "code\modules\clothing\under\shorts.dm" #include "code\modules\clothing\under\syndicate.dm" #include "code\modules\clothing\under\trek.dm" @@ -3111,12 +3112,10 @@ #include "modular_citadel\code\modules\client\loadout\suit.dm" #include "modular_citadel\code\modules\client\loadout\uniform.dm" #include "modular_citadel\code\modules\client\verbs\who.dm" -#include "modular_citadel\code\modules\clothing\clothing.dm" #include "modular_citadel\code\modules\clothing\neck.dm" #include "modular_citadel\code\modules\clothing\spacesuits\flightsuit.dm" #include "modular_citadel\code\modules\clothing\suits\polychromic_cloaks.dm" #include "modular_citadel\code\modules\clothing\suits\suits.dm" -#include "modular_citadel\code\modules\clothing\under\polychromic_clothes.dm" #include "modular_citadel\code\modules\clothing\under\trek_under.dm" #include "modular_citadel\code\modules\clothing\under\turtlenecks.dm" #include "modular_citadel\code\modules\clothing\under\under.dm"