diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index b16002e35b..e0f7457a4a 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -249,6 +249,7 @@ // /obj/item/clothing signals #define COMSIG_SHOES_STEP_ACTION "shoes_step_action" //from base of obj/item/clothing/shoes/proc/step_action(): () +#define COMSIG_SUIT_MADE_HELMET "suit_made_helmet" //from base of obj/item/clothing/suit/MakeHelmet(): (helmet) // /obj/item/implant signals #define COMSIG_IMPLANT_ACTIVATED "implant_activated" //from base of /obj/item/implant/proc/activate(): () diff --git a/code/datums/elements/polychromic.dm b/code/datums/elements/polychromic.dm index 70424507b7..f664ed9063 100644 --- a/code/datums/elements/polychromic.dm +++ b/code/datums/elements/polychromic.dm @@ -14,13 +14,16 @@ var/list/already_updates_onmob = list() var/poly_flags var/worn_file //used in place of items' held or mob overlay icons if present. + var/static/list/suits_with_helmet_typecache = typecacheof(list(/obj/item/clothing/suit/hooded, /obj/item/clothing/suit/space/hardsuit)) + var/list/helmet_by_suit //because poly winter coats exist. + var/list/suit_by_helmet //Idem. -/datum/element/polychromic/Attach(datum/target, list/colors, states, _icon, _flags = POLYCHROMIC_ALTCLICK|POLYCHROMIC_NO_HELD, _worn, list/names = list("Primary", "Secondary", "Tertiary", "Quaternary", "Quinary", "Senary")) +/datum/element/polychromic/Attach(datum/target, list/colors, states, _flags = POLYCHROMIC_ACTION|POLYCHROMIC_NO_HELD, _icon, _worn, list/names = list("Primary", "Secondary", "Tertiary", "Quaternary", "Quinary", "Senary")) . = ..() var/make_appearances = islist(states) var/states_len = make_appearances ? length(states) : states var/names_len = length(names) - if(!states_len || !names_len || !isatom(target)) + if(!states_len || !names_len || colors_by_atom[target] || !isatom(target)) return ELEMENT_INCOMPATIBLE var/atom/A = target @@ -59,8 +62,10 @@ if(!SSdcs.GetElement(/datum/element/update_icon_updates_onmob)) A.AddElement(/datum/element/update_icon_updates_onmob) else - already_updates_onmob[A]++ + LAZYSET(already_updates_onmob, A, TRUE) RegisterSignal(A, COMSIG_ITEM_WORN_OVERLAYS, .proc/apply_worn_overlays) + if(suits_with_helmet_typecache[A.type]) + RegisterSignal(A, COMSIG_SUIT_MADE_HELMET, .proc/register_helmet) else if(_flags & POLYCHROMIC_ACTION && ismob(A)) //in the event mob update icon procs are ever standarized. var/datum/action/polychromic/P = new(A) RegisterSignal(P, COMSIG_ACTION_TRIGGER, .proc/activate_action) @@ -71,33 +76,48 @@ /datum/element/polychromic/Detach(atom/A) . = ..() - A.cut_overlay(colors_by_atom[A]) colors_by_atom -= A - if(!(poly_flags & POLYCHROMIC_NO_HELD) && !(poly_flags & POLYCHROMIC_NO_WORN) && isitem(A)) - if(!already_updates_onmob[A]) - A.RemoveElement(/datum/element/update_icon_updates_onmob) - else - already_updates_onmob[A]-- - if(!already_updates_onmob[A]) - already_updates_onmob -= A var/datum/action/polychromic/P = actions_by_atom[A] if(P) actions_by_atom -= A qdel(P) - UnregisterSignal(A, list(COMSIG_PARENT_EXAMINE, COMSIG_CLICK_ALT, COMSIG_ATOM_UPDATE_OVERLAYS, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED, COMSIG_ITEM_WORN_OVERLAYS)) + UnregisterSignal(A, list(COMSIG_PARENT_EXAMINE, COMSIG_CLICK_ALT, COMSIG_ATOM_UPDATE_OVERLAYS, COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED, COMSIG_ITEM_WORN_OVERLAYS, COMSIG_SUIT_MADE_HELMET)) + if(isitem(A)) + if(!(poly_flags & POLYCHROMIC_NO_HELD) && !(poly_flags & POLYCHROMIC_NO_WORN)) + if(!already_updates_onmob[A]) + A.RemoveElement(/datum/element/update_icon_updates_onmob) + else + LAZYREMOVE(already_updates_onmob, A) + var/obj/item/clothing/head/H = helmet_by_suit[A] + if(H) + UnregisterSignal(H, list(COMSIG_ATOM_UPDATE_OVERLAYS, COMSIG_ITEM_WORN_OVERLAYS, COMSIG_PARENT_QDELETING)) + LAZYREMOVE(helmet_by_suit, A) + LAZYREMOVE(suit_by_helmet, H) + colors_by_atom -= H + if(!QDELETED(H)) + H.update_icon() //removing the overlays + if(!QDELETED(A) && ismob(A.loc)) + var/mob/M = A.loc + if(!(poly_flags & POLYCHROMIC_NO_HELD) && M.is_holding(A)) + M.update_inv_hands() + else if(!(poly_flags & POLYCHROMIC_NO_WORN)) + M.regenerate_icons() + if(!QDELETED(A)) + A.update_icon() //removing the overlays /datum/element/polychromic/proc/apply_overlays(atom/source, list/overlays) var/list/L = colors_by_atom[source] + var/f_icon = icon_file || source.icon if(isnum(overlays_states)) for(var/i in 1 to overlays_states) - overlays += mutable_appearance(source.icon, "[source.icon_state]-[i]", color = L[i]) + overlays += mutable_appearance(f_icon, "[source.icon_state]-[i]", color = L[i]) else overlays += colors_by_atom[source] -/datum/element/polychromic/proc/apply_worn_overlays(obj/item/source, isinhands, icon_file, used_state, style_flags, list/overlays) +/datum/element/polychromic/proc/apply_worn_overlays(obj/item/source, isinhands, icon, used_state, style_flags, list/overlays) if(poly_flags & (isinhands ? POLYCHROMIC_NO_HELD : POLYCHROMIC_NO_WORN)) return - var/f_icon = worn_file || icon_file + var/f_icon = worn_file || icon var/list/L = colors_by_atom[source] if(isnum(overlays_states)) @@ -148,6 +168,20 @@ /datum/element/polychromic/proc/on_examine(atom/source, mob/user, list/examine_list) examine_list += "Alt-click to recolor it." +/datum/element/polychromic/proc/register_helmet(atom/source, obj/item/clothing/head/H) + LAZYSET(suit_by_helmet, H, source) + LAZYSET(helmet_by_suit, source, H) + colors_by_atom[H] = colors_by_atom[source] + RegisterSignal(H, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/apply_overlays) + RegisterSignal(H, COMSIG_ITEM_WORN_OVERLAYS, .proc/apply_worn_overlays) + RegisterSignal(H, COMSIG_PARENT_QDELETING, .proc/unregister_helmet) + +/datum/element/polychromic/proc/unregister_helmet(atom/source) + var/obj/item/clothing/suit/S = suit_by_helmet[source] + LAZYREMOVE(suit_by_helmet, source) + LAZYREMOVE(helmet_by_suit, S) + colors_by_atom -= source + /datum/action/polychromic name = "Modify Polychromic Colors" background_icon_state = "bg_polychromic" diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 402d16e7ec..d484027ad5 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -47,25 +47,12 @@ //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() . = ..() if(CHECK_BITFIELD(clothing_flags, VOICEBOX_TOGGLABLE)) 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) . = ..() @@ -150,8 +137,6 @@ 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) @@ -195,173 +180,6 @@ BLIND // can't see anything female_clothing_icon = fcopy_rsc(female_clothing_icon) GLOB.female_clothing_icons[index] = female_clothing_icon -/obj/item/clothing/under/verb/toggle() - set name = "Adjust Suit Sensors" - set category = "Object" - set src in usr - var/mob/M = usr - if (istype(M, /mob/dead/)) - return - if (!can_use(M)) - return - if(src.has_sensor == LOCKED_SENSORS) - to_chat(usr, "The controls are locked.") - return 0 - if(src.has_sensor == BROKEN_SENSORS) - to_chat(usr, "The sensors have shorted out!") - return 0 - if(src.has_sensor <= NO_SENSORS) - to_chat(usr, "This suit does not have any sensors.") - return 0 - - var/list/modes = list("Off", "Binary vitals", "Exact vitals", "Tracking beacon") - var/switchMode = input("Select a sensor mode:", "Suit Sensor Mode", modes[sensor_mode + 1]) in modes - if(get_dist(usr, src) > 1) - to_chat(usr, "You have moved too far away!") - return - sensor_mode = modes.Find(switchMode) - 1 - - if (src.loc == usr) - switch(sensor_mode) - if(0) - to_chat(usr, "You disable your suit's remote sensing equipment.") - if(1) - to_chat(usr, "Your suit will now only report whether you are alive or dead.") - if(2) - to_chat(usr, "Your suit will now only report your exact vital lifesigns.") - if(3) - to_chat(usr, "Your suit will now report your exact vital lifesigns as well as your coordinate position.") - - if(ishuman(loc)) - var/mob/living/carbon/human/H = loc - if(H.w_uniform == src) - H.update_suit_sensors() - - -/obj/item/clothing/under/CtrlClick(mob/user) - . = ..() - - if (!(item_flags & IN_INVENTORY)) - return - - if(!isliving(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user))) - return - - if(has_sensor == LOCKED_SENSORS) - to_chat(user, "The controls are locked.") - return - if(has_sensor == BROKEN_SENSORS) - to_chat(user, "The sensors have shorted out!") - return - if(has_sensor <= NO_SENSORS) - to_chat(user, "This suit does not have any sensors.") - return - - sensor_mode = SENSOR_COORDS - - to_chat(user, "Your suit will now report your exact vital lifesigns as well as your coordinate position.") - - if(ishuman(user)) - var/mob/living/carbon/human/H = user - if(H.w_uniform == src) - H.update_suit_sensors() - -/obj/item/clothing/under/AltClick(mob/user) - . = ..() - if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user))) - return - if(attached_accessory) - 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/neck/AltClick(mob/user) - . = ..() - if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user))) - return - // 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 - set src in usr - rolldown() - -/obj/item/clothing/under/proc/rolldown() - if(!can_use(usr)) - return - if(!can_adjust) - to_chat(usr, "You cannot wear this suit any differently!") - return - if(toggle_jumpsuit_adjust()) - to_chat(usr, "You adjust the suit to wear it more casually.") - else - to_chat(usr, "You adjust the suit back to normal.") - if(ishuman(usr)) - var/mob/living/carbon/human/H = usr - H.update_inv_w_uniform() - H.update_body() - -/obj/item/clothing/under/proc/toggle_jumpsuit_adjust() - adjusted = !adjusted - - if(adjusted) - if(fitted != FEMALE_UNIFORM_TOP) - fitted = NO_FEMALE_UNIFORM - if(!alt_covers_chest) // for the special snowflake suits that expose the chest when adjusted - body_parts_covered &= ~CHEST - else - fitted = initial(fitted) - if(!alt_covers_chest) - body_parts_covered |= CHEST - - return adjusted - /obj/item/clothing/proc/weldingvisortoggle(mob/user) //proc to toggle welding visors on helmets, masks, goggles, etc. if(!can_use(user)) return FALSE @@ -441,15 +259,3 @@ BLIND // can't see anything return FALSE return TRUE - -/obj/item/clothing/update_overlays() // Polychrome stuff - . = ..() - if(hasprimary) //Checks if the overlay is enabled - var/mutable_appearance/primary_overlay = mutable_appearance(icon, "[item_state]-primary", color = primary_color) //Automagically picks overlays - . += 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_state]-secondary", color = secondary_color) - . += secondary_overlay - if(hastertiary) - var/mutable_appearance/tertiary_overlay = mutable_appearance(icon, "[item_state]-tertiary", color = tertiary_color) - . += tertiary_overlay diff --git a/code/modules/clothing/neck/_neck.dm b/code/modules/clothing/neck/_neck.dm index f775fca203..33666d2b00 100644 --- a/code/modules/clothing/neck/_neck.dm +++ b/code/modules/clothing/neck/_neck.dm @@ -169,54 +169,44 @@ name = "pet collar" desc = "It's for pets. Though you probably could wear it yourself, you'd doubtless be the subject of ridicule. It seems to be made out of a polychromic material." icon_state = "petcollar" - mob_overlay_icon = 'icons/mob/clothing/neck.dmi' //Because, as it appears, the item itself is normally not directly aware of its worn overlays, so this is about the easiest way, without adding a new var. - hasprimary = TRUE - primary_color = "#00BBBB" pocket_storage_component_path = /datum/component/storage/concrete/pockets/small/collar + var/poly_states = 1 + var/poly_colors = list("#00BBBB") var/tagname = null + var/treat_path = /obj/item/reagent_containers/food/snacks/cookie + +/obj/item/clothing/neck/petcollar/Initialize() + . = ..() + if(treat_path) + new treat_path(src) + +/obj/item/clothing/neck/petcollar/ComponentInitialize() + . = ..() + if(!poly_states) + return + AddElement(/datum/element/polychromic, poly_colors, poly_states) /obj/item/clothing/neck/petcollar/attack_self(mob/user) tagname = stripped_input(user, "Would you like to change the name on the tag?", "Name your new pet", "Spot", MAX_NAME_LEN) name = "[initial(name)] - [tagname]" -/obj/item/clothing/neck/petcollar/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) - . = ..() - 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(mob_overlay_icon, "[icon_state]-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(mob_overlay_icon, "[icon_state]-secondary") - secondary_worn.color = secondary_color - . += secondary_worn - if(hastertiary) - var/mutable_appearance/tertiary_worn = mutable_appearance(mob_overlay_icon, "[icon_state]-tertiary") - tertiary_worn.color = tertiary_color - . += tertiary_worn - /obj/item/clothing/neck/petcollar/leather name = "leather pet collar" icon_state = "leathercollar" - - hasprimary = TRUE - hassecondary = TRUE - primary_color = "#222222" - secondary_color = "#888888" + poly_states = 2 + poly_colors = list("#222222", "#888888") /obj/item/clothing/neck/petcollar/choker desc = "Quite fashionable... if you're somebody who's just read their first BDSM-themed erotica novel." name = "choker" icon_state = "choker" - - hasprimary = TRUE - primary_color = "#222222" + poly_colors = list("#222222") /obj/item/clothing/neck/petcollar/locked name = "locked collar" desc = "A collar that has a small lock on it to keep it from being removed." pocket_storage_component_path = /datum/component/storage/concrete/pockets/small/collar/locked + treat_path = /obj/item/key/collar var/lock = FALSE /obj/item/clothing/neck/petcollar/locked/attackby(obj/item/K, mob/user, params) @@ -238,32 +228,19 @@ /obj/item/clothing/neck/petcollar/locked/leather name = "leather pet collar" icon_state = "leathercollar" - - hasprimary = TRUE - hassecondary = TRUE - primary_color = "#222222" - secondary_color = "#888888" + poly_states = 2 + poly_colors = list("#222222", "#888888") /obj/item/clothing/neck/petcollar/locked/choker name = "choker" desc = "Quite fashionable... if you're somebody who's just read their first BDSM-themed erotica novel." icon_state = "choker" - - hasprimary = TRUE - primary_color = "#222222" + poly_colors = list("#222222") /obj/item/key/collar name = "Collar Key" desc = "A key for a tiny lock on a collar or bag." -/obj/item/clothing/neck/petcollar/Initialize() - . = ..() - new /obj/item/reagent_containers/food/snacks/cookie(src) - -/obj/item/clothing/neck/petcollar/locked/Initialize() - . = ..() - new /obj/item/key/collar(src) - ////////////// //DOPE BLING// ////////////// diff --git a/code/modules/clothing/suits/cloaks.dm b/code/modules/clothing/suits/cloaks.dm index 7d56fbe6dd..ce3d2576f9 100644 --- a/code/modules/clothing/suits/cloaks.dm +++ b/code/modules/clothing/suits/cloaks.dm @@ -91,3 +91,14 @@ heat_protection = HEAD max_heat_protection_temperature = FIRE_IMMUNITY_MAX_TEMP_PROTECT resistance_flags = FIRE_PROOF | ACID_PROOF | GOLIATH_RESISTANCE + +/obj/item/clothing/neck/cloak/polychromic + name = "polychromic cloak" + desc = "For when you want to show off your horrible colour coordination skills." + icon_state = "polyce" + item_state = "qmcloak" + var/list/poly_colors = list("#FFFFFF", "#FFFFFF", "#808080") + +/obj/item/clothing/neck/cloak/polychromic/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, poly_colors, 3) diff --git a/code/modules/clothing/suits/miscellaneous.dm b/code/modules/clothing/suits/miscellaneous.dm index 71f04afc9c..c133ea7c88 100644 --- a/code/modules/clothing/suits/miscellaneous.dm +++ b/code/modules/clothing/suits/miscellaneous.dm @@ -974,70 +974,11 @@ icon_state = "coatpoly" item_state = "coatpoly" hoodtype = /obj/item/clothing/head/hooded/winterhood/polychromic - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE - primary_color = "#6A6964" - secondary_color = "#C4B8A6" - tertiary_color = "#0000FF" + +/obj/item/clothing/suit/hooded/wintercoat/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, list("#6A6964", "#C4B8A6", "#0000FF"), 3) /obj/item/clothing/head/hooded/winterhood/polychromic icon_state = "winterhood_poly" item_state = "winterhood_poly" - -/obj/item/clothing/head/hooded/winterhood/polychromic/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) //this is where the main magic happens. - . = ..() - if(suit.hasprimary | suit.hassecondary) - if(!isinhands) //prevents the worn sprites from showing up if you're just holding them - if(suit.hasprimary) //checks if overlays are enabled - var/mutable_appearance/primary_worn = mutable_appearance(icon_file, "[icon_state]-primary") //automagical sprite selection - primary_worn.color = suit.primary_color //colors the overlay - . += primary_worn //adds the overlay onto the buffer list to draw on the mob sprite. - if(suit.hassecondary) - var/mutable_appearance/secondary_worn = mutable_appearance(icon_file, "[icon_state]-secondary") - secondary_worn.color = suit.secondary_color - . += secondary_worn - -/obj/item/clothing/suit/hooded/wintercoat/polychromic/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) //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(icon_file, "[icon_state]-primary[suittoggled ? "_t" : ""]") //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(icon_file, "[icon_state]-secondary[suittoggled ? "_t" : ""]") - secondary_worn.color = secondary_color - . += secondary_worn - if(hastertiary) - var/mutable_appearance/tertiary_worn = mutable_appearance(icon_file, "[icon_state]-tertiary[suittoggled ? "_t" : ""]") - tertiary_worn.color = tertiary_color - . += tertiary_worn - -/obj/item/clothing/suit/hooded/wintercoat/AltClick(mob/user) - . = ..() - if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user))) - return - 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 diff --git a/code/modules/clothing/suits/toggles.dm b/code/modules/clothing/suits/toggles.dm index cbbd64ebcc..4f29eab6ab 100644 --- a/code/modules/clothing/suits/toggles.dm +++ b/code/modules/clothing/suits/toggles.dm @@ -6,7 +6,7 @@ var/hoodtype = /obj/item/clothing/head/hooded/winterhood //so the chaplain hoodie or other hoodies can override this /obj/item/clothing/suit/hooded/New() - MakeHood() + hood = MakeHelmet() ..() /obj/item/clothing/suit/hooded/Destroy() @@ -14,11 +14,15 @@ qdel(hood) hood = null -/obj/item/clothing/suit/hooded/proc/MakeHood() +/obj/item/clothing/suit/proc/MakeHelmet(obj/item/clothing/head/H) + SEND_SIGNAL(src, COMSIG_SUIT_MADE_HELMET, H) + return H + +/obj/item/clothing/suit/hooded/MakeHelmet(obj/item/clothing/head/hooded/H) if(!hood) - var/obj/item/clothing/head/hooded/W = new hoodtype(src) - W.suit = src - hood = W + H = new hoodtype(src) + H.suit = src + return ..() /obj/item/clothing/suit/hooded/ui_action_click() ToggleHood() @@ -125,7 +129,7 @@ //Hardsuit toggle code /obj/item/clothing/suit/space/hardsuit/Initialize() - MakeHelmet() + helmet = MakeHelmet() . = ..() /obj/item/clothing/suit/space/hardsuit/Destroy() @@ -140,13 +144,13 @@ suit.helmet = null return ..() -/obj/item/clothing/suit/space/hardsuit/proc/MakeHelmet() +/obj/item/clothing/suit/space/hardsuit/MakeHelmet(obj/item/clothing/head/helmet/space/hardsuit/H) if(!helmettype) return if(!helmet) - var/obj/item/clothing/head/helmet/space/hardsuit/W = new helmettype(src) - W.suit = src - helmet = W + H = new helmettype(src) + H.suit = src + return ..() /obj/item/clothing/suit/space/hardsuit/ui_action_click() ..() diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index 42783ab518..fe3aaf4bda 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -19,27 +19,13 @@ var/mutable_appearance/accessory_overlay /obj/item/clothing/under/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(isinhands) return if(damaged_clothes) . += mutable_appearance('icons/effects/item_damage.dmi', "damageduniform") if(blood_DNA) . += mutable_appearance('icons/effects/blood.dmi', "uniformblood", color = blood_DNA_to_color()) - if(accessory_overlay) - . += accessory_overlay - if(hasprimary) //checks if overlays are enabled - var/mutable_appearance/primary_worn = mutable_appearance(icon_file, "[icon_state]-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(icon_file, "[icon_state]-secondary") - secondary_worn.color = secondary_color - . += secondary_worn - if(hastertiary) - var/mutable_appearance/tertiary_worn = mutable_appearance(icon_file, "[icon_state]-tertiary") - tertiary_worn.color = tertiary_color - . += tertiary_worn /obj/item/clothing/under/attackby(obj/item/I, mob/user, params) if((has_sensor == BROKEN_SENSORS) && istype(I, /obj/item/stack/cable_coil)) @@ -167,5 +153,121 @@ if(attached_accessory) . += "\A [attached_accessory] is attached to it." +/obj/item/clothing/under/verb/toggle() + set name = "Adjust Suit Sensors" + set category = "Object" + set src in usr + var/mob/M = usr + if (istype(M, /mob/dead/)) + return + if (!can_use(M)) + return + if(src.has_sensor == LOCKED_SENSORS) + to_chat(usr, "The controls are locked.") + return 0 + if(src.has_sensor == BROKEN_SENSORS) + to_chat(usr, "The sensors have shorted out!") + return 0 + if(src.has_sensor <= NO_SENSORS) + to_chat(usr, "This suit does not have any sensors.") + return 0 + + var/list/modes = list("Off", "Binary vitals", "Exact vitals", "Tracking beacon") + var/switchMode = input("Select a sensor mode:", "Suit Sensor Mode", modes[sensor_mode + 1]) in modes + if(get_dist(usr, src) > 1) + to_chat(usr, "You have moved too far away!") + return + sensor_mode = modes.Find(switchMode) - 1 + + if (src.loc == usr) + switch(sensor_mode) + if(0) + to_chat(usr, "You disable your suit's remote sensing equipment.") + if(1) + to_chat(usr, "Your suit will now only report whether you are alive or dead.") + if(2) + to_chat(usr, "Your suit will now only report your exact vital lifesigns.") + if(3) + to_chat(usr, "Your suit will now report your exact vital lifesigns as well as your coordinate position.") + + if(ishuman(loc)) + var/mob/living/carbon/human/H = loc + if(H.w_uniform == src) + H.update_suit_sensors() + + +/obj/item/clothing/under/CtrlClick(mob/user) + . = ..() + + if (!(item_flags & IN_INVENTORY)) + return + + if(!isliving(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user))) + return + + if(has_sensor == LOCKED_SENSORS) + to_chat(user, "The controls are locked.") + return + if(has_sensor == BROKEN_SENSORS) + to_chat(user, "The sensors have shorted out!") + return + if(has_sensor <= NO_SENSORS) + to_chat(user, "This suit does not have any sensors.") + return + + sensor_mode = SENSOR_COORDS + + to_chat(user, "Your suit will now report your exact vital lifesigns as well as your coordinate position.") + + if(ishuman(user)) + var/mob/living/carbon/human/H = user + if(H.w_uniform == src) + H.update_suit_sensors() + +/obj/item/clothing/under/AltClick(mob/user) + . = ..() + if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, ismonkey(user))) + return + if(attached_accessory) + remove_accessory(user) + else + rolldown() + +/obj/item/clothing/under/verb/jumpsuit_adjust() + set name = "Adjust Jumpsuit Style" + set category = null + set src in usr + rolldown() + +/obj/item/clothing/under/proc/rolldown() + if(!can_use(usr)) + return + if(!can_adjust) + to_chat(usr, "You cannot wear this suit any differently!") + return + if(toggle_jumpsuit_adjust()) + to_chat(usr, "You adjust the suit to wear it more casually.") + else + to_chat(usr, "You adjust the suit back to normal.") + if(ishuman(usr)) + var/mob/living/carbon/human/H = usr + H.update_inv_w_uniform() + H.update_body() + +/obj/item/clothing/under/proc/toggle_jumpsuit_adjust() + adjusted = !adjusted + + if(adjusted) + if(fitted != FEMALE_UNIFORM_TOP) + fitted = NO_FEMALE_UNIFORM + if(!alt_covers_chest) // for the special snowflake suits that expose the chest when adjusted + body_parts_covered &= ~CHEST + else + fitted = initial(fitted) + if(!alt_covers_chest) + body_parts_covered |= CHEST + + return adjusted + /obj/item/clothing/under/rank dying_key = DYE_REGISTRY_UNDER diff --git a/code/modules/clothing/under/costume.dm b/code/modules/clothing/under/costume.dm index 7cbfe5abf5..69a1dc67b3 100644 --- a/code/modules/clothing/under/costume.dm +++ b/code/modules/clothing/under/costume.dm @@ -96,7 +96,7 @@ /obj/item/clothing/under/costume/kilt/polychromic/ComponentInitialize() . = ..() - AddElement(/datum/element/polychromic, list("#FFFFFF", "#F08080"), list("polykilt-primary", "polykilt-secondary"), null, POLYCHROMIC_ALTCLICK|POLYCHROMIC_NO_HELD|POLYCHROMIC_ACTION) + AddElement(/datum/element/polychromic, list("#FFFFFF", "#F08080"), 2) /obj/item/clothing/under/costume/gladiator name = "gladiator uniform" diff --git a/code/modules/clothing/under/miscellaneous.dm b/code/modules/clothing/under/miscellaneous.dm index a7557a0702..d475ca8100 100644 --- a/code/modules/clothing/under/miscellaneous.dm +++ b/code/modules/clothing/under/miscellaneous.dm @@ -241,69 +241,67 @@ desc = "A fancy button-up shirt made with polychromic threads." icon_state = "polysuit" item_state = "sl_suit" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE - primary_color = "#FFFFFF" - secondary_color = "#353535" - tertiary_color = "#353535" mutantrace_variation = NONE +/obj/item/clothing/under/misc/poly_shirt/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, list("#FFFFFF", "#353535", "#353535"), 3) + /obj/item/clothing/under/misc/polyshorts name = "polychromic shorts" desc = "For ease of movement and style." icon_state = "polyshorts" item_state = "rainbow" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE - primary_color = "#353535" - secondary_color = "#808080" - tertiary_color = "#808080" can_adjust = FALSE body_parts_covered = CHEST|GROIN|ARMS +/obj/item/clothing/under/misc/polyshorts/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, list("#353535", "#808080", "#808080"), 3) + /obj/item/clothing/under/misc/polyjumpsuit name = "polychromic tri-tone jumpsuit" desc = "A fancy jumpsuit made with polychromic threads." icon_state = "polyjump" item_state = "rainbow" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE - primary_color = "#FFFFFF" - secondary_color = "#808080" - tertiary_color = "#FF3535" can_adjust = FALSE mutantrace_variation = NONE +/obj/item/clothing/under/misc/polyjumpsuit/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, list("#FFFFFF", "#808080", "#353535"), 3) + /obj/item/clothing/under/misc/poly_bottomless name = "polychromic bottomless shirt" - desc = "Great for showing off your junk in dubious style." + desc = "Great for showing off your underwear in dubious style." icon_state = "polybottomless" item_state = "rainbow" - primary_color = "#808080" - secondary_color = "#FF3535" body_parts_covered = CHEST|ARMS //Because there's no bottom included can_adjust = FALSE mutantrace_variation = NONE +/obj/item/clothing/under/misc/poly_bottomless/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, list("#808080", "#FF3535"), 2) + /obj/item/clothing/under/misc/poly_tanktop name = "polychromic tank top" desc = "For those lazy summer days." icon_state = "polyshimatank" item_state = "rainbow" - primary_color = "#808080" - secondary_color = "#FFFFFF" - tertiary_color = "#8CC6FF" body_parts_covered = CHEST|GROIN can_adjust = FALSE mutantrace_variation = NONE + var/list/poly_states = 3 + var/list/poly_colors = list("#808080", "#FFFFFF", "#8CC6FF") + +/obj/item/clothing/under/misc/poly_tanktop/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, poly_colors, poly_states) /obj/item/clothing/under/misc/poly_tanktop/female name = "polychromic feminine tank top" desc = "Great for showing off your chest in style. Not recommended for males." icon_state = "polyfemtankpantsu" - hastertiary = FALSE - primary_color = "#808080" - secondary_color = "#FF3535" + poly_states = 2 + poly_colors = list("#808080", "#FF3535") diff --git a/code/modules/clothing/under/shorts.dm b/code/modules/clothing/under/shorts.dm index ebf7cb5896..f61a41e4c3 100644 --- a/code/modules/clothing/under/shorts.dm +++ b/code/modules/clothing/under/shorts.dm @@ -35,19 +35,18 @@ desc = "95% Polychrome, 5% Spandex!" icon_state = "polyshortpants" item_state = "rainbow" - hasprimary = TRUE - hassecondary = TRUE - primary_color = "#FFFFFF" - secondary_color = "#F08080" mutantrace_variation = NONE + var/list/poly_colors = list("#FFFFFF", "#F08080") + +/obj/item/clothing/under/shorts/polychromic/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, poly_colors, 2) /obj/item/clothing/under/shorts/polychromic/pantsu name = "polychromic panties" desc = "Topless striped panties. Now with 120% more polychrome!" icon_state = "polypantsu" item_state = "rainbow" - hastertiary = FALSE - primary_color = "#FFFFFF" - secondary_color = "#8CC6FF" body_parts_covered = GROIN mutantrace_variation = NONE + poly_colors = list("#FFFFFF", "#8CC6FF") diff --git a/code/modules/clothing/under/skirt_dress.dm b/code/modules/clothing/under/skirt_dress.dm index f00e96d821..fa2c9eed71 100644 --- a/code/modules/clothing/under/skirt_dress.dm +++ b/code/modules/clothing/under/skirt_dress.dm @@ -211,21 +211,18 @@ desc = "A fancy skirt made with polychromic threads." icon_state = "polyskirt" item_state = "rainbow" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE - primary_color = "#FFFFFF" - secondary_color = "#F08080" - tertiary_color = "#808080" mutantrace_variation = NONE + var/list/poly_colors = list("#FFFFFF", "#F08080", "#808080") + +/obj/item/clothing/under/dress/skirt/polychromic/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, poly_colors, 3) /obj/item/clothing/under/dress/skirt/polychromic/pleated name = "polychromic pleated skirt" desc = "A magnificent pleated skirt complements the woolen polychromatic sweater." icon_state = "polypleat" item_state = "rainbow" - primary_color = "#8CC6FF" - secondary_color = "#808080" - tertiary_color = "#FF3535" body_parts_covered = CHEST|GROIN|ARMS mutantrace_variation = NONE + poly_colors = list("#8CC6FF", "#808080", "#FF3535") diff --git a/code/modules/clothing/under/suits.dm b/code/modules/clothing/under/suits.dm index 3ee5204c3b..087262dd1e 100644 --- a/code/modules/clothing/under/suits.dm +++ b/code/modules/clothing/under/suits.dm @@ -109,11 +109,9 @@ desc = "For when you want to show off your horrible colour coordination skills." icon_state = "polysuit" item_state = "sl_suit" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE - primary_color = "#FFFFFF" - secondary_color = "#FFFFFF" - tertiary_color = "#808080" can_adjust = FALSE mutantrace_variation = NONE + +/obj/item/clothing/under/suit/polychromic/ComponentInitialize() + . = ..() + AddElement(/datum/element/polychromic, list("#FFFFFF", "#FFFFFF", "#808080"), 3) diff --git a/icons/mob/clothing/head.dmi b/icons/mob/clothing/head.dmi index c499c236e3..f2ea9fa55d 100644 Binary files a/icons/mob/clothing/head.dmi and b/icons/mob/clothing/head.dmi differ diff --git a/icons/mob/clothing/neck.dmi b/icons/mob/clothing/neck.dmi index de59a136d9..68fde7bff9 100644 Binary files a/icons/mob/clothing/neck.dmi and b/icons/mob/clothing/neck.dmi differ diff --git a/icons/mob/clothing/suit.dmi b/icons/mob/clothing/suit.dmi index 195e4ecd67..a2ea222a68 100644 Binary files a/icons/mob/clothing/suit.dmi and b/icons/mob/clothing/suit.dmi differ diff --git a/icons/mob/clothing/suit_digi.dmi b/icons/mob/clothing/suit_digi.dmi index 67ad9f7e1a..5287bac43c 100644 Binary files a/icons/mob/clothing/suit_digi.dmi and b/icons/mob/clothing/suit_digi.dmi differ diff --git a/icons/mob/clothing/uniform.dmi b/icons/mob/clothing/uniform.dmi index fe0b080dc6..4485a9a5f8 100644 Binary files a/icons/mob/clothing/uniform.dmi and b/icons/mob/clothing/uniform.dmi differ diff --git a/icons/mob/clothing/uniform_digi.dmi b/icons/mob/clothing/uniform_digi.dmi index 9deb214335..6827581b85 100644 Binary files a/icons/mob/clothing/uniform_digi.dmi and b/icons/mob/clothing/uniform_digi.dmi differ diff --git a/icons/obj/clothing/hats.dmi b/icons/obj/clothing/hats.dmi index 07d9c8cee6..2e0906ea20 100644 Binary files a/icons/obj/clothing/hats.dmi and b/icons/obj/clothing/hats.dmi differ diff --git a/icons/obj/clothing/neck.dmi b/icons/obj/clothing/neck.dmi index 0bdaa36e62..cf8e13292f 100644 Binary files a/icons/obj/clothing/neck.dmi and b/icons/obj/clothing/neck.dmi differ diff --git a/icons/obj/clothing/suits.dmi b/icons/obj/clothing/suits.dmi index 530cd61e6f..607c26bb62 100644 Binary files a/icons/obj/clothing/suits.dmi and b/icons/obj/clothing/suits.dmi differ diff --git a/icons/obj/clothing/uniforms.dmi b/icons/obj/clothing/uniforms.dmi index 55ec7669ba..dfebe38155 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/suits/polychromic_cloaks.dm b/modular_citadel/code/modules/clothing/suits/polychromic_cloaks.dm deleted file mode 100644 index c2b7aab55f..0000000000 --- a/modular_citadel/code/modules/clothing/suits/polychromic_cloaks.dm +++ /dev/null @@ -1,38 +0,0 @@ -/obj/item/clothing/neck/cloak/polychromic //enables all three overlays to reduce copypasta and defines basic stuff - name = "polychromic cloak" - desc = "For when you want to show off your horrible colour coordination skills." - icon = 'modular_citadel/icons/polyclothes/item/neck.dmi' - mob_overlay_icon = 'modular_citadel/icons/polyclothes/mob/neck.dmi' - icon_state = "polyce" - item_state = "qmcloak" - hasprimary = TRUE - hassecondary = TRUE - hastertiary = TRUE - primary_color = "#FFFFFF" //RGB in hexcode - secondary_color = "#FFFFFF" - tertiary_color = "#808080" - -/obj/item/clothing/neck/cloak/polychromic/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) //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(mob_overlay_icon, "[icon_state]-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(mob_overlay_icon, "[icon_state]-secondary") - secondary_worn.color = secondary_color - . += secondary_worn - if(hastertiary) - var/mutable_appearance/tertiary_worn = mutable_appearance(mob_overlay_icon, "[icon_state]-tertiary") - tertiary_worn.color = tertiary_color - . += tertiary_worn - -/obj/item/clothing/neck/cloak/polychromic/polyce //DONATOR ITEM - name = "polychromic embroidered cloak" - desc = "A fancy cloak embroidered with polychromatic thread in a pattern that reminds one of the wielders of unlimited power." - icon_state = "polyce" - primary_color = "#808080" //RGB in hexcode - secondary_color = "#8CC6FF" - tertiary_color = "#FF3535" \ No newline at end of file diff --git a/modular_citadel/code/modules/custom_loadout/custom_items.dm b/modular_citadel/code/modules/custom_loadout/custom_items.dm index a9b502d629..bd377d6081 100644 --- a/modular_citadel/code/modules/custom_loadout/custom_items.dm +++ b/modular_citadel/code/modules/custom_loadout/custom_items.dm @@ -563,3 +563,8 @@ unique_reskin = list("Goodboye" = "fritz", "Badboye" = "fritz_bad") mutantrace_variation = NONE +/obj/item/clothing/neck/cloak/polychromic/polyce + name = "polychromic embroidered cloak" + desc = "A fancy cloak embroidered with polychromatic thread in a pattern that reminds one of the wielders of unlimited power." + icon_state = "polyce" + poly_colors = list("#808080", "#8CC6FF", "#FF3535") diff --git a/modular_citadel/icons/polyclothes/item/neck.dmi b/modular_citadel/icons/polyclothes/item/neck.dmi deleted file mode 100644 index e2792cf9d0..0000000000 Binary files a/modular_citadel/icons/polyclothes/item/neck.dmi and /dev/null differ diff --git a/modular_citadel/icons/polyclothes/mob/neck.dmi b/modular_citadel/icons/polyclothes/mob/neck.dmi deleted file mode 100644 index 529c64caa2..0000000000 Binary files a/modular_citadel/icons/polyclothes/mob/neck.dmi and /dev/null differ diff --git a/tgstation.dme b/tgstation.dme index 84d74db295..5d0ca735bc 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -3291,7 +3291,6 @@ #include "modular_citadel\code\modules\client\verbs\who.dm" #include "modular_citadel\code\modules\clothing\neck.dm" #include "modular_citadel\code\modules\clothing\trek.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\custom_loadout\custom_items.dm" #include "modular_citadel\code\modules\custom_loadout\load_to_mob.dm"