From 47078e9a85411807af398aecec4b61ddecb91d24 Mon Sep 17 00:00:00 2001 From: keronshb Date: Thu, 26 Aug 2021 11:58:09 -0400 Subject: [PATCH] Ports Hair Gradiants --- code/__HELPERS/global_lists.dm | 6 ++ code/_globalvars/lists/flavor_misc.dm | 1 + code/datums/traits/neutral.dm | 17 ++++++ code/game/objects/items/dyekit.dm | 40 +++++++++++++ code/modules/cargo/packs/goodies.dm | 6 ++ .../sprite_accessories/hair_head.dm | 55 ++++++++++++++++++ .../mob/living/carbon/human/human_defines.dm | 5 ++ .../mob/living/carbon/human/species.dm | 19 ++++++ code/modules/vending/games.dm | 1 + icons/mob/hair_gradients.dmi | Bin 0 -> 2404 bytes icons/obj/dyespray.dmi | Bin 0 -> 407 bytes tgstation.dme | 1 + 12 files changed, 151 insertions(+) create mode 100644 code/game/objects/items/dyekit.dm create mode 100644 icons/mob/hair_gradients.dmi create mode 100644 icons/obj/dyespray.dmi diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 0a17f0d1df..19aac1aee0 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -78,6 +78,12 @@ var/datum/emote/E = new path() E.emote_list[E.key] = E + // Hair Gradients - Initialise all /datum/sprite_accessory/hair_gradient into an list indexed by gradient-style name + for(var/path in subtypesof(/datum/sprite_accessory/hair_gradient)) + var/datum/sprite_accessory/hair_gradient/H = new path() + GLOB.hair_gradients_list[H.name] = H + + // Keybindings init_keybindings() //Uplink Items diff --git a/code/_globalvars/lists/flavor_misc.dm b/code/_globalvars/lists/flavor_misc.dm index 28f657828b..64c96cae3b 100644 --- a/code/_globalvars/lists/flavor_misc.dm +++ b/code/_globalvars/lists/flavor_misc.dm @@ -6,6 +6,7 @@ GLOBAL_LIST_EMPTY(hair_styles_female_list) //stores only hair names GLOBAL_LIST_EMPTY(facial_hair_styles_list) //stores /datum/sprite_accessory/facial_hair indexed by name GLOBAL_LIST_EMPTY(facial_hair_styles_male_list) //stores only hair names GLOBAL_LIST_EMPTY(facial_hair_styles_female_list) //stores only hair names +GLOBAL_LIST_EMPTY(hair_gradients_list) //stores /datum/sprite_accessory/hair_gradient indexed by name //Underwear GLOBAL_LIST_EMPTY_TYPED(underwear_list, /datum/sprite_accessory/underwear/bottom) //stores bottoms indexed by name GLOBAL_LIST_EMPTY(underwear_m) //stores only underwear name diff --git a/code/datums/traits/neutral.dm b/code/datums/traits/neutral.dm index 2f0667d942..36712ea6bb 100644 --- a/code/datums/traits/neutral.dm +++ b/code/datums/traits/neutral.dm @@ -162,3 +162,20 @@ gain_text = "You feel like munching on a can of soda." lose_text = "You no longer feel like you should be eating trash." mob_trait = TRAIT_TRASHCAN + +/datum/quirk/colorist + name = "Colorist" + desc = "You like carrying around a hair dye spray to quickly apply color patterns to your hair." + value = 0 + medical_record_text = "Patient enjoys dyeing their hair with pretty colors." + +/datum/quirk/colorist/on_spawn() + var/mob/living/carbon/human/H = quirk_holder + var/obj/item/dyespray/spraycan = new(get_turf(quirk_holder)) + H.equip_to_slot(spraycan, SLOT_IN_BACKPACK) + H.regenerate_icons() + +/datum/quirk/colorist/post_add() + var/mob/living/carbon/human/H = quirk_holder + SEND_SIGNAL(H.back, COMSIG_TRY_STORAGE_SHOW, H) + to_chat(quirk_holder, "You brought some extra dye with you! It's in your bag if you forgot.") diff --git a/code/game/objects/items/dyekit.dm b/code/game/objects/items/dyekit.dm new file mode 100644 index 0000000000..43a05c7939 --- /dev/null +++ b/code/game/objects/items/dyekit.dm @@ -0,0 +1,40 @@ +/obj/item/dyespray + name = "hair dye spray" + desc = "A spray to dye your hair any gradients you'd like." + icon = 'icons/obj/dyespray.dmi' + icon_state = "dyespray" + +/obj/item/dyespray/attack_self(mob/user) + dye(user) + +/obj/item/dyespray/pre_attack(atom/target, mob/living/user, params) + dye(target) + return ..() + +/** + * Applies a gradient and a gradient color to a mob. + * + * Arguments: + * * target - The mob who we will apply the gradient and gradient color to. + */ + +/obj/item/dyespray/proc/dye(mob/target) + if(!ishuman(target)) + return + var/mob/living/carbon/human/human_target = target + + var/new_grad_style = input(usr, "Choose a color pattern:", "Character Preference") as null|anything in GLOB.hair_gradients_list + if(!new_grad_style) + return + + var/new_grad_color = input(usr, "Choose a secondary hair color:", "Character Preference","#"+human_target.grad_color) as color|null + if(!new_grad_color) + return + + human_target.grad_style = new_grad_style + human_target.grad_color = sanitize_hexcolor(new_grad_color) + to_chat(human_target, "You start applying the hair dye...") + if(!do_after(usr, 30, target = human_target)) + return + playsound(src, 'sound/effects/spray.ogg', 5, TRUE, 5) + human_target.update_hair() diff --git a/code/modules/cargo/packs/goodies.dm b/code/modules/cargo/packs/goodies.dm index 5d4598fd58..5151845221 100644 --- a/code/modules/cargo/packs/goodies.dm +++ b/code/modules/cargo/packs/goodies.dm @@ -70,6 +70,12 @@ cost = 1500 contains = list(/obj/item/toy/plush/beeplushie) +/datum/supply_pack/goody/dyespray + name = "Hair Dye Spray" + desc = "A cool spray to dye your hair with awesome colors!" + cost = PAYCHECK_EASY * 2 + contains = list(/obj/item/dyespray) + /datum/supply_pack/goody/beach_ball name = "Beach Ball" desc = "The simple beach ball is one of Nanotrasen's most popular products. 'Why do we make beach balls? Because we can! (TM)' - Nanotrasen" diff --git a/code/modules/mob/dead/new_player/sprite_accessories/hair_head.dm b/code/modules/mob/dead/new_player/sprite_accessories/hair_head.dm index 88dda923a0..e002fa369d 100644 --- a/code/modules/mob/dead/new_player/sprite_accessories/hair_head.dm +++ b/code/modules/mob/dead/new_player/sprite_accessories/hair_head.dm @@ -1058,3 +1058,58 @@ /datum/sprite_accessory/hair/zone name = "Zone" icon_state = "hair_zone" + +/datum/sprite_accessory/hair_gradient + icon = 'icons/mob/hair_gradients.dmi' + +/datum/sprite_accessory/hair_gradient/none + name = "None" + icon_state = "none" + +/datum/sprite_accessory/hair_gradient/fadeup + name = "Fade Up" + icon_state = "fadeup" + +/datum/sprite_accessory/hair_gradient/fadedown + name = "Fade Down" + icon_state = "fadedown" + +/datum/sprite_accessory/hair_gradient/vertical_split + name = "Vertical Split" + icon_state = "vsplit" + +/datum/sprite_accessory/hair_gradient/_split + name = "Horizontal Split" + icon_state = "bottomflat" + +/datum/sprite_accessory/hair_gradient/reflected + name = "Reflected" + icon_state = "reflected_high" + +/datum/sprite_accessory/hair_gradient/reflected_inverse + name = "Reflected Inverse" + icon_state = "reflected_inverse_high" + +/datum/sprite_accessory/hair_gradient/wavy + name = "Wavy" + icon_state = "wavy" + +/datum/sprite_accessory/hair_gradient/long_fade_up + name = "Long Fade Up" + icon_state = "long_fade_up" + +/datum/sprite_accessory/hair_gradient/long_fade_down + name = "Long Fade Down" + icon_state = "long_fade_down" + +/datum/sprite_accessory/hair_gradient/short_fade_up + name = "Short Fade Up" + icon_state = "short_fade_up" + +/datum/sprite_accessory/hair_gradient/short_fade_down + name = "Short Fade Down" + icon_state = "short_fade_down" + +/datum/sprite_accessory/hair_gradient/wavy_spike + name = "Spiked Wavy" + icon_state = "wavy_spiked" diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index de934318b3..5e488e463e 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -20,6 +20,11 @@ var/hair_color = "000" var/hair_style = "Bald" + ///Colour used for the hair gradient. + var/grad_color = "000" + ///Style used for the hair gradient. + var/grad_style + //Facial hair colour and style var/facial_hair_color = "000" var/facial_hair_style = "Shaved" diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 6f94be2d41..80edd142b7 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -52,6 +52,10 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) var/hair_color ///The alpha used by the hair. 255 is completely solid, 0 is invisible. var/hair_alpha = 255 + ///The gradient style used for the mob's hair. + var/grad_style + ///The gradient color used to color the gradient. + var/grad_color ///Does the species use skintones or not? As of now only used by humans. var/use_skintones = FALSE @@ -678,6 +682,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) if(!hair_hidden || dynamic_hair_suffix) var/mutable_appearance/hair_overlay = mutable_appearance(layer = -HAIR_LAYER) + var/mutable_appearance/gradient_overlay = mutable_appearance(layer = -HAIR_LAYER) if(!hair_hidden && !H.getorgan(/obj/item/organ/brain)) //Applies the debrained overlay if there is no brain if(!(NOBLOOD in species_traits)) hair_overlay.icon = 'icons/mob/human_parts.dmi' @@ -713,8 +718,21 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) hair_overlay.color = "#" + hair_color else hair_overlay.color = "#" + H.hair_color + + //Gradients + grad_style = H.grad_style + grad_color = H.grad_color + if(grad_style) + var/datum/sprite_accessory/gradient = GLOB.hair_gradients_list[grad_style] + var/icon/temp = icon(gradient.icon, gradient.icon_state) + var/icon/temp_hair = icon(hair_file, hair_state) + temp.Blend(temp_hair, ICON_ADD) + gradient_overlay.icon = temp + gradient_overlay.color = "#" + grad_color + else hair_overlay.color = forced_colour + hair_overlay.alpha = hair_alpha if(OFFSET_HAIR in H.dna.species.offset_features) @@ -723,6 +741,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) if(hair_overlay.icon) standing += hair_overlay + standing += gradient_overlay if(standing.len) H.overlays_standing[HAIR_LAYER] = standing diff --git a/code/modules/vending/games.dm b/code/modules/vending/games.dm index cea9c5ae70..a1d9bc1691 100644 --- a/code/modules/vending/games.dm +++ b/code/modules/vending/games.dm @@ -9,6 +9,7 @@ /obj/item/toy/cards/deck/cas/black = 3, /obj/item/toy/cards/deck/unum = 3, /obj/item/cardpack/series_one = 10, + /obj/item/dyespray=3, /obj/item/tcgcard_binder = 5) contraband = list(/obj/item/dice/fudge = 9) premium = list(/obj/item/melee/skateboard/pro = 3, diff --git a/icons/mob/hair_gradients.dmi b/icons/mob/hair_gradients.dmi new file mode 100644 index 0000000000000000000000000000000000000000..ceb3b52eab9538ec174b631779cd1e0bbe7fd527 GIT binary pat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z$YEdWAr#{ovnGc@-z=skZon%B=swuS?EX4(9chs&YRjIHx00)HA0I%pe6s^0cwmt^ z{oiu-7`oV0JJbf0CSTz>{?B6;08u^(jlFi|&oi8LhJc!kMp-Ko8>AA34^7;7fh%8n zJH>1%doujNjWuPC>ROhG6EPjLtCe8MTk(#BDMI0yp{2vYPVq?0_5<2ezezU{EoA=s zh^s-yFepXU%@qzhsdk^EL{Q{u!8ZNH(hr%WZc!l!_v1==hF9_{$>r#k%2ni?pn>>2?e>ht4qc(C&bCTs|c@t(`MJ%LA{1RvZosyKK7b z!F>Tq7nv!JkM;}Hk)Y_Mj_i43o}R9h0r(Jf;PgAt?LvHVHeH`lRSt-66+Z-ds1~h%+IZk#=y~2gHAnG*UiaGqPyTfdlHmmJ13r46FR*{fWm0#7l&h!cI z74Fml7JFicFM!O8>5qsQ?BOE{qn#W$rSKDGd?5FI^#a8DB{f=2hZlF@P6;+XFX*7B zgu=iU?Z#fPB(IQ6sG@cWWlgvSV_skfCnO!3IH3}fEXi~1d;6WC^B0vEqvn?6NTt>L z-7r-eJYm_o45nJP43S~Z%H0SA{AMVO5)d&Q?N5-@ORdex$gWh;TUcerHbXWh5&U{H zclX}cHYADM`l#h-1%qR%V`RR8_BTl<-b@7h$na_`$iIDUfTP%Kv!T2`7L-)prJt0T z0C5(3WB2QFwnLyzZ}(cHycX_EiFMmEA9vr~6w9hQI7)Xu`_L+Rn*hfvXw<9A{^|b( DB*}r> literal 0 HcmV?d00001 diff --git a/icons/obj/dyespray.dmi b/icons/obj/dyespray.dmi new file mode 100644 index 0000000000000000000000000000000000000000..eb056036799a8ee5f09b00474bf8ea7a6899410a GIT binary patch literal 407 zcmV;I0cie-P)8YOd)e&nWt7de{K7EB)c>8RKY77Y<*w#|%Kq%Cmc!xy-Bib6 z>P>~nYDBpIzJE#;yvhIo00DGTPE!Ct=GbNc003-yR9JLGWpiV4X>fFDZ*Bkpc$`yK zaB_9`^iy#0_2eo`Eh^5;&r`5fFwryM;w;ZhDainGjE%TBGg33tGfE(w;*!LYR3K9+ zr82d+peV6YiHkEOv#1y-WXQ#tR+N~V3SlcNxca$(O$Gp;of~`|`C