diff --git a/code/datums/elements/polychromic.dm b/code/datums/elements/polychromic.dm index f664ed9063..bce5a765fe 100644 --- a/code/datums/elements/polychromic.dm +++ b/code/datums/elements/polychromic.dm @@ -9,11 +9,10 @@ var/overlays_states //A list or a number of states. In the latter case, the atom icon_state/item_state will be used followed by a number. var/list/colors_by_atom = list() //list of color strings or mutable appearances, depending on the above variable. var/icon_file + var/worn_file //used in place of items' held or mob overlay icons if present. var/list/overlays_names //wrap numbers into text strings please. var/list/actions_by_atom = list() - 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. @@ -58,11 +57,8 @@ if(_flags & POLYCHROMIC_ACTION) RegisterSignal(A, COMSIG_ITEM_EQUIPPED, .proc/grant_user_action) RegisterSignal(A, COMSIG_ITEM_DROPPED, .proc/remove_user_action) - if(!(_flags & POLYCHROMIC_NO_HELD) && !(_flags & POLYCHROMIC_NO_WORN)) - if(!SSdcs.GetElement(/datum/element/update_icon_updates_onmob)) - A.AddElement(/datum/element/update_icon_updates_onmob) - else - LAZYSET(already_updates_onmob, A, TRUE) + if(!(_flags & POLYCHROMIC_NO_WORN) || !(_flags & POLYCHROMIC_NO_HELD)) + A.AddElement(/datum/element/update_icon_updates_onmob) 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) @@ -83,19 +79,16 @@ 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, 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 + 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(!(poly_flags & POLYCHROMIC_NO_WORN) || !(poly_flags & POLYCHROMIC_NO_HELD)) + A.RemoveElement(/datum/element/update_icon_updates_onmob) if(!QDELETED(A) && ismob(A.loc)) var/mob/M = A.loc if(!(poly_flags & POLYCHROMIC_NO_HELD) && M.is_holding(A)) @@ -124,26 +117,29 @@ for(var/i in 1 to overlays_states) overlays += mutable_appearance(f_icon, "[used_state]-[i]", color = L[i]) else - for(var/I in 1 to length(overlays_states)) - var/mutable_appearance/M = L[I] - overlays += mutable_appearance(f_icon, overlays_states[I], color = M.color) + for(var/i in 1 to length(overlays_states)) + var/mutable_appearance/M = L[i] + overlays += mutable_appearance(f_icon, overlays_states[i], color = M.color) /datum/element/polychromic/proc/set_color(atom/source, mob/user) var/choice = input(user,"Polychromic options", "Recolor [source]") as null|anything in overlays_names if(!choice || QDELETED(source) || !user.canUseTopic(source, BE_CLOSE, NO_DEXTERY)) return - var/ncolor = input(user, "Polychromic options", "Choose [choice] Color") as color|null - if(!ncolor || QDELETED(source) || !user.canUseTopic(source, BE_CLOSE, NO_DEXTERY)) - return + var/index = overlays_names.Find(choice) var/list/L = colors_by_atom[source] if(!L) // Ummmmmh. return - var/K = L[overlays_names.Find(choice)] - if(istext(K)) - K = sanitize_hexcolor(ncolor, 6, TRUE, K) + var/mutable_appearance/M = L[index] + var/old_color = istype(M) ? M.color : M + var/ncolor = input(user, "Polychromic options", "Choose [choice] Color", old_color) as color|null + if(!ncolor || QDELETED(source) || !colors_by_atom[source] || !user.canUseTopic(source, BE_CLOSE, NO_DEXTERY)) + return + ncolor = sanitize_hexcolor(ncolor, 6, TRUE, old_color) + if(istype(M)) + M.color = ncolor else - var/mutable_appearance/M = K - M.color = sanitize_hexcolor(ncolor, 6, TRUE, M.color) + L[index] = ncolor + source.update_icon() return TRUE @@ -153,6 +149,7 @@ var/datum/action/polychromic/P = actions_by_atom[source] if(!P) P = new (source) + P.name = "Modify [source]'\s Colors" actions_by_atom[source] = P P.check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUN|AB_CHECK_CONSCIOUS RegisterSignal(P, COMSIG_ACTION_TRIGGER, .proc/activate_action) @@ -187,4 +184,4 @@ background_icon_state = "bg_polychromic" use_target_appearance = TRUE button_icon_state = null - target_appearance_matrix = list(0.75,0,0,0,0.75,0) + target_appearance_matrix = list(0.8,0,0,0,0.8,0) diff --git a/code/game/objects/items/holy_weapons.dm b/code/game/objects/items/holy_weapons.dm index 845d14ccff..ac60a322d8 100644 --- a/code/game/objects/items/holy_weapons.dm +++ b/code/game/objects/items/holy_weapons.dm @@ -304,7 +304,7 @@ var/shield_icon = "shield-red" /obj/item/nullrod/staff/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(isinhands) . += mutable_appearance('icons/effects/effects.dmi', shield_icon, MOB_LAYER + 0.01) diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index 5210f00e99..6ff5dfc8ad 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -377,7 +377,7 @@ add_overlay(filling) /obj/item/reagent_containers/chemtank/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) //apply chemcolor and level - . = list() + . = ..() //inhands + reagent_filling if(!isinhands && reagents.total_volume) var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "backpackmob-10") diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index 24fe73ba12..e9f517a9f1 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -54,7 +54,7 @@ . += base_overlay /obj/item/screwdriver/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(isinhands && random_color) var/mutable_appearance/M = mutable_appearance(icon_file, "screwdriver_head") M.appearance_flags = RESET_COLOR diff --git a/code/modules/antagonists/clockcult/clock_items/clockwork_slab.dm b/code/modules/antagonists/clockcult/clock_items/clockwork_slab.dm index e6045b2548..5837ac302d 100644 --- a/code/modules/antagonists/clockcult/clock_items/clockwork_slab.dm +++ b/code/modules/antagonists/clockcult/clock_items/clockwork_slab.dm @@ -122,7 +122,7 @@ addtimer(CALLBACK(src, .proc/check_on_mob, user), 1) //dropped is called before the item is out of the slot, so we need to check slightly later /obj/item/clockwork/slab/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(isinhands && item_state && inhand_overlay) var/mutable_appearance/M = mutable_appearance(icon_file, "slab_[inhand_overlay]") . += M diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index ea6bfa9b92..b05aa7f769 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -452,7 +452,7 @@ return BLOCK_NONE /obj/item/clothing/suit/hooded/cultrobes/cult_shield/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(!isinhands && current_charges) . += mutable_appearance('icons/effects/cult_effects.dmi', "shield-cult", MOB_LAYER + 0.01) diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index 362e4a5605..8cbc416b2e 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -347,7 +347,7 @@ colored_before = TRUE /obj/item/clothing/glasses/sunglasses/blindfold/white/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(!isinhands && ishuman(loc) && !colored_before) var/mob/living/carbon/human/H = loc var/mutable_appearance/M = mutable_appearance('icons/mob/clothing/eyes.dmi', "blindfoldwhite") diff --git a/code/modules/clothing/gloves/_gloves.dm b/code/modules/clothing/gloves/_gloves.dm index 21ebeaa2bb..ddf5e4b584 100644 --- a/code/modules/clothing/gloves/_gloves.dm +++ b/code/modules/clothing/gloves/_gloves.dm @@ -27,7 +27,7 @@ return OXYLOSS /obj/item/clothing/gloves/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(!isinhands) if(damaged_clothes) . += mutable_appearance('icons/effects/item_damage.dmi', "damagedgloves") diff --git a/code/modules/clothing/head/_head.dm b/code/modules/clothing/head/_head.dm index 121217c128..475e7a4e51 100644 --- a/code/modules/clothing/head/_head.dm +++ b/code/modules/clothing/head/_head.dm @@ -49,7 +49,7 @@ /obj/item/clothing/head/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(!isinhands) if(damaged_clothes) . += mutable_appearance('icons/effects/item_damage.dmi', "damagedhelmet") diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 4ef2970a24..9c96223a6f 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -205,7 +205,7 @@ icon_state = S.icon_state /obj/item/clothing/head/wig/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(!isinhands) var/datum/sprite_accessory/S = GLOB.hair_styles_list[hair_style] if(!S) diff --git a/code/modules/clothing/masks/_masks.dm b/code/modules/clothing/masks/_masks.dm index ac087fd9e2..7df38661e5 100644 --- a/code/modules/clothing/masks/_masks.dm +++ b/code/modules/clothing/masks/_masks.dm @@ -29,7 +29,7 @@ /obj/item/clothing/mask/proc/handle_speech() /obj/item/clothing/mask/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(!isinhands) if(body_parts_covered & HEAD) if(damaged_clothes) diff --git a/code/modules/clothing/neck/_neck.dm b/code/modules/clothing/neck/_neck.dm index 33666d2b00..402ea37f21 100644 --- a/code/modules/clothing/neck/_neck.dm +++ b/code/modules/clothing/neck/_neck.dm @@ -7,7 +7,7 @@ equip_delay_other = 40 /obj/item/clothing/neck/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(!isinhands) if(body_parts_covered & HEAD) if(damaged_clothes) diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index cc5e88c5d6..802dd7265e 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -50,7 +50,7 @@ last_blood_DNA = blood_dna[blood_dna.len] /obj/item/clothing/shoes/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() if(!isinhands) var/bloody = FALSE if(blood_DNA) diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 3505a35487..94c8d7219c 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -87,7 +87,7 @@ add_overlay(tag_overlay) /obj/item/pizzabox/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) - . = list() + . = ..() var/current_offset = 2 if(isinhands) for(var/V in boxes) //add EXTRA BOX per box diff --git a/icons/obj/clothing/cloaks.dmi b/icons/obj/clothing/cloaks.dmi index dd1ae7d727..6f4de62cc0 100644 Binary files a/icons/obj/clothing/cloaks.dmi and b/icons/obj/clothing/cloaks.dmi differ diff --git a/icons/obj/clothing/neck.dmi b/icons/obj/clothing/neck.dmi index cf8e13292f..622f43ea56 100644 Binary files a/icons/obj/clothing/neck.dmi and b/icons/obj/clothing/neck.dmi differ