From fb97695b6a64daef9416f983ae783d8d0afd5407 Mon Sep 17 00:00:00 2001 From: Michiyamenotehifunana <31995558+Michiyamenotehifunana@users.noreply.github.com> Date: Tue, 27 Mar 2018 22:40:27 +0800 Subject: [PATCH 1/2] Globalized, Broke everything --- .../code/modules/clothing/clothing.dm | 80 +++++++++++++ .../clothing/under/polychromic_clothes.dm | 113 ++---------------- 2 files changed, 93 insertions(+), 100 deletions(-) create mode 100644 modular_citadel/code/modules/clothing/clothing.dm diff --git a/modular_citadel/code/modules/clothing/clothing.dm b/modular_citadel/code/modules/clothing/clothing.dm new file mode 100644 index 0000000000..ead9e70d14 --- /dev/null +++ b/modular_citadel/code/modules/clothing/clothing.dm @@ -0,0 +1,80 @@ +/* // +// 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 // +// // +*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/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" + +/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.update_inv_w_uniform() //updates the worn icon + 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.update_inv_w_uniform() + 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.update_inv_w_uniform() + +/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/examine(mob/user) + ..() + if(hasprimary | hassecondary | hastertiary) + to_chat(user, "Alt-click to recolor it.") // so people don't "OOC how do you use polychromic clothes????" + +/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/code/modules/clothing/under/polychromic_clothes.dm b/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm index c3b361148c..b2b0fa7903 100644 --- a/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm +++ b/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm @@ -1,102 +1,32 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Polychromic Clothes: // +// Polychromic Uniforms: // // // // 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 // -// worn sprites. After that, copy paste the code from any of the example clothes beneath the giant mass of procs and // +// 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. // // // // -Tori // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/obj/item/clothing/under/polychromic //This is the parent object. DO NOT copy paste this and its vars if you want to make something new. +/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' //To make human/update_icon.dm read worn sprites from here. + alternate_worn_icon = 'modular_citadel/icons/polyclothes/mob/uniform.dmi' icon_state = "polysuit" - item_color = "polysuit" //The item color is used to select its mob icon - item_state = "sl_suit" //Inhand sprites. Would be an arse to make one for all the clothes. Should probably be standardized to rainbow. - can_adjust = FALSE //to prevent you from "wearing it casually" - - var/hasprimary = TRUE //These vars allow you to choose which overlays a clothing has - var/hassecondary = TRUE - var/hastertiary = TRUE - - var/primary_color = "#FFFFFF" //RGB in hexcode - var/secondary_color = "#FFFFFF" - var/tertiary_color = "#808080" - -/obj/item/clothing/under/polychromic/update_icon() - ..() - cut_overlays() //prevents the overlays from infinitely stacking - if(hasprimary) //Checks if the overlay is enabled - var/mutable_appearance/primary_overlay = mutable_appearance('modular_citadel/icons/polyclothes/item/uniform.dmi', "[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('modular_citadel/icons/polyclothes/item/uniform.dmi', "[item_color]-secondary") - secondary_overlay.color = secondary_color - add_overlay(secondary_overlay) - if(hastertiary) - var/mutable_appearance/tertiary_overlay = mutable_appearance('modular_citadel/icons/polyclothes/item/uniform.dmi', "[item_color]-tertiary") - tertiary_overlay.color = tertiary_color - add_overlay(tertiary_overlay) - -/obj/item/clothing/under/polychromic/AltClick(mob/living/user) - if(!in_range(src, user)) //Basic checks to prevent abuse - return - if(user.incapacitated() || !istype(user)) - to_chat(user, "You can't do that right now!") - return - - 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.update_inv_w_uniform() //updates the worn icon - 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.update_inv_w_uniform() - 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.update_inv_w_uniform() - -/obj/item/clothing/under/polychromic/worn_overlays(isinhands, icon_file) //this is where the main magic happens - . = ..() - 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('modular_citadel/icons/polyclothes/mob/uniform.dmi', "[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('modular_citadel/icons/polyclothes/mob/uniform.dmi', "[item_color]-secondary") - secondary_worn.color = secondary_color - . += secondary_worn - if(hastertiary) - var/mutable_appearance/tertiary_worn = mutable_appearance('modular_citadel/icons/polyclothes/mob/uniform.dmi', "[item_color]-tertiary") - tertiary_worn.color = tertiary_color - . += tertiary_worn - -/obj/item/clothing/under/polychromic/examine(mob/user) - ..() - to_chat(user, "Alt-click to recolor it.") // so people don't "OOC how do you use polychromic clothes????" - -/obj/item/clothing/under/polychromic/Initialize() - ..() - update_icon() //Applies the overlays and default colors onto the clothes on spawn. + item_color = "polysuit" + item_state = "sl_suit" + hasprimary = TRUE + hassecondary = TRUE + hastertiary = TRUE + primary_color = "#FFFFFF" //RGB in hexcode + secondary_color = "#FFFFFF" + tertiary_color = "#808080" + can_adjust = FALSE //Don't touch this var unless you know what you're doing /obj/item/clothing/under/polychromic/shirt //COPY PASTE THIS TO MAKE A NEW THING name = "polychromic button-up shirt" @@ -104,9 +34,6 @@ icon_state = "polysuit" item_color = "polysuit" item_state = "sl_suit" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE primary_color = "#FFFFFF" //RGB in hexcode secondary_color = "#353535" tertiary_color = "#353535" @@ -117,9 +44,6 @@ icon_state = "polykilt" item_color = "polykilt" item_state = "kilt" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE primary_color = "#FFFFFF" //RGB in hexcode secondary_color = "#F08080" tertiary_color = "#808080" @@ -130,9 +54,6 @@ icon_state = "polyskirt" item_color = "polyskirt" item_state = "rainbow" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE primary_color = "#FFFFFF" //RGB in hexcode secondary_color = "#F08080" tertiary_color = "#808080" @@ -143,9 +64,6 @@ icon_state = "polyshorts" item_color = "polyshorts" item_state = "rainbow" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE primary_color = "#353535" //RGB in hexcode secondary_color = "#808080" tertiary_color = "#808080" @@ -156,9 +74,6 @@ icon_state = "polyjump" item_color = "polyjump" item_state = "rainbow" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE primary_color = "#FFFFFF" //RGB in hexcode secondary_color = "#808080" tertiary_color = "#FF3535" @@ -169,8 +84,6 @@ icon_state = "polyshortpants" item_color = "polyshortpants" item_state = "rainbow" - hasprimary = TRUE - hassecondary = TRUE hastertiary = FALSE primary_color = "#FFFFFF" //RGB in hexcode secondary_color = "#F08080" From 7015e631a28182be5a8040199dd318bdbbcdd8b7 Mon Sep 17 00:00:00 2001 From: Michiyamenotehifunana <31995558+Michiyamenotehifunana@users.noreply.github.com> Date: Thu, 29 Mar 2018 23:51:55 +0800 Subject: [PATCH 2/2] Fixes everything, adds loadout stuff "Fix" mandates the usage of workarounds --- .../code/modules/client/loadout/uniform.dm | 18 ++++++++ .../code/modules/clothing/clothing.dm | 42 +++++++++++-------- .../clothing/under/polychromic_clothes.dm | 19 ++++++++- tgstation.dme | 3 +- 4 files changed, 63 insertions(+), 19 deletions(-) diff --git a/modular_citadel/code/modules/client/loadout/uniform.dm b/modular_citadel/code/modules/client/loadout/uniform.dm index acb2b4e13c..c07290cdaf 100644 --- a/modular_citadel/code/modules/client/loadout/uniform.dm +++ b/modular_citadel/code/modules/client/loadout/uniform.dm @@ -123,6 +123,24 @@ category = slot_w_uniform path = /obj/item/clothing/under/syndicate/cosmetic +/datum/gear/polykilt + name = "Polychromic Kilt" + category = slot_w_uniform + path = /obj/item/clothing/under/polychromic/kilt + cost = 3 + +/datum/gear/polyshorts + name = "Polychromic Shorts" + category = slot_w_uniform + path = /obj/item/clothing/under/polychromic/shorts + cost = 3 + +/datum/gear/polyshortpants + name = "Polychromic Athletic Shorts" + category = slot_w_uniform + path = /obj/item/clothing/under/polychromic/shortpants + cost = 2 + // Trekie things //TOS /datum/gear/trekcmdtos diff --git a/modular_citadel/code/modules/clothing/clothing.dm b/modular_citadel/code/modules/clothing/clothing.dm index ead9e70d14..d638f59808 100644 --- a/modular_citadel/code/modules/clothing/clothing.dm +++ b/modular_citadel/code/modules/clothing/clothing.dm @@ -5,6 +5,31 @@ // // *///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// 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 @@ -52,23 +77,6 @@ update_icon() user.update_inv_w_uniform() -/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/examine(mob/user) ..() if(hasprimary | hassecondary | hastertiary) diff --git a/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm b/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm index b2b0fa7903..4f8985dac5 100644 --- a/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm +++ b/modular_citadel/code/modules/clothing/under/polychromic_clothes.dm @@ -26,7 +26,24 @@ primary_color = "#FFFFFF" //RGB in hexcode secondary_color = "#FFFFFF" tertiary_color = "#808080" - can_adjust = FALSE //Don't touch this var unless you know what you're doing + can_adjust = FALSE + +/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 + . = ..() + 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/under/polychromic/shirt //COPY PASTE THIS TO MAKE A NEW THING name = "polychromic button-up shirt" diff --git a/tgstation.dme b/tgstation.dme index 07746da3b9..676c1f5cb4 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -2689,7 +2689,6 @@ #include "modular_citadel\code\modules\admin\topic.dm" #include "modular_citadel\code\modules\antagonists\cit_crewobjectives.dm" #include "modular_citadel\code\modules\antagonists\cit_miscreants.dm" -#include "modular_citadel\code\modules\antagonists\cult\blood_magic.dm" #include "modular_citadel\code\modules\antagonists\crew_objectives\cit_crewobjectives_cargo.dm" #include "modular_citadel\code\modules\antagonists\crew_objectives\cit_crewobjectives_civilian.dm" #include "modular_citadel\code\modules\antagonists\crew_objectives\cit_crewobjectives_command.dm" @@ -2697,6 +2696,7 @@ #include "modular_citadel\code\modules\antagonists\crew_objectives\cit_crewobjectives_medical.dm" #include "modular_citadel\code\modules\antagonists\crew_objectives\cit_crewobjectives_science.dm" #include "modular_citadel\code\modules\antagonists\crew_objectives\cit_crewobjectives_security.dm" +#include "modular_citadel\code\modules\antagonists\cult\blood_magic.dm" #include "modular_citadel\code\modules\arousal\arousal.dm" #include "modular_citadel\code\modules\arousal\organs\breasts.dm" #include "modular_citadel\code\modules\arousal\organs\eggsack.dm" @@ -2731,6 +2731,7 @@ #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\spacesuits\flightsuit.dm" #include "modular_citadel\code\modules\clothing\suits\suits.dm" #include "modular_citadel\code\modules\clothing\under\polychromic_clothes.dm"