Commit c0d74188 authored by Shadowmech88's avatar Shadowmech88 Committed by clusterfack
Browse files

Adds Hair Dye (#12448)

* Adds hair dye.

* Changes hair dye's visible_messages.

* Makes hair dye check a species-level can_have_hair variable.

* Changes the species check to a better check using do_colouration.
Also adds spray sound to hair dye.

* Can no longer color hair or facial hair if the target's clothing covers it.

* Fixes some typos.
parent dc96c984
......@@ -361,7 +361,8 @@ var/list/all_supply_groups = list("Supplies","Clothing","Security","Hospitality"
/obj/item/clothing/mask/gas/mime,
/obj/item/clothing/head/beret,
/obj/item/clothing/suit/suspenders,
/obj/item/weapon/reagent_containers/food/drinks/bottle/bottleofnothing)
/obj/item/weapon/reagent_containers/food/drinks/bottle/bottleofnothing,
/obj/item/weapon/hair_dye)
cost = 10
containertype = /obj/structure/closet/crate/secure
containername = "Standard Costumes"
......
......@@ -88,4 +88,105 @@
H.lip_style = null
H.update_body()
else
..()
\ No newline at end of file
..()
/obj/item/weapon/hair_dye
name = "can of hair dye"
desc = "A can of sprayable hair dye. There is a dial on the top for color selection."
icon = 'icons/obj/items.dmi'
icon_state = "hair_dye"
flags = FPRINT
w_class = W_CLASS_SMALL
var/color_r = 255
var/color_g = 255
var/color_b = 255
/obj/item/weapon/hair_dye/New()
..()
color_r = rand(0,255)
color_g = rand(0,255)
color_b = rand(0,255)
update_icon()
/obj/item/weapon/hair_dye/update_icon()
overlays.len = 0
var/icon/dye_color = new/icon("icon" = 'icons/obj/items.dmi', "icon_state" = "dye_color_overlay")
dye_color.Blend(rgb(color_r, color_g, color_b), ICON_ADD)
overlays += dye_color
/obj/item/weapon/hair_dye/attack_self(mob/user as mob)
var/new_color = input(user, "Choose the dye's color:", "Color Select") as color|null
if(new_color)
color_r = hex2num(copytext(new_color, 2, 4))
color_g = hex2num(copytext(new_color, 4, 6))
color_b = hex2num(copytext(new_color, 6, 8))
update_icon()
/obj/item/weapon/hair_dye/attack(mob/M as mob, mob/user as mob)
if(!istype(M, /mob))
return
if(ishuman(M))
var/mob/living/carbon/human/H = M
var/area = user.zone_sel.selecting
var/area_string = "hair"
if(area == "mouth")
var/obj/item/clothing/cover = H.get_body_part_coverage(MOUTH)
if(cover)
to_chat(user, "<span class='notice'>You can't color [H == user ? "your" : "\the [H]'s"] facial hair through that [cover.name]!</span>")
return
if(!H.f_style || H.f_style == "Shaved") //if they have no facial hair
to_chat(user, "<span class='notice'>[H == user ? "You don't" : "\The [H] doesn't"] seem to have any facial hair!</span>")
return
else
var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[H.f_style]
if(!facial_hair_style.do_colouration)
to_chat(user, "<span class='notice'>[H == user ? "You don't" : "\The [H] doesn't"] seem to have any colorable facial hair!</span>")
return
area_string = "facial hair"
else
var/obj/item/clothing/cover = H.get_body_part_coverage(HEAD)
if(cover)
to_chat(user, "<span class='notice'>You can't color [H == user ? "your" : "\the [H]'s"] hair through that [cover.name]!</span>")
return
if(!H.h_style || H.h_style == "Bald") //if they have no hair
to_chat(user, "<span class='notice'>[H == user ? "You don't" : "\The [H] doesn't"] seem to have any hair!</span>")
return
else
var/datum/sprite_accessory/hair_style = hair_styles_list[H.h_style]
if(!hair_style.do_colouration)
to_chat(user, "<span class='notice'>[H == user ? "You don't" : "\The [H] doesn't"] seem to have any colorable hair!</span>")
return
if(H == user)
user.visible_message("<span class='notice'>[user] colors their [area_string] with \the [src].</span>", \
"<span class='notice'>You color your [area_string] with \the [src].</span>")
if(area == "mouth")
color_hair(H,1)
else
color_hair(H)
else
user.visible_message("<span class='warning'>[user] begins to color \the [H]'s [area_string] with \the [src].</span>", \
"<span class='notice'>You begin to color \the [H]'s [area_string] with \the [src].</span>")
if(do_after(user,H, 20)) //user needs to keep their active hand, H does not.
user.visible_message("<span class='notice'>[user] colors [H]'s [area_string] with \the [src].</span>", \
"<span class='notice'>You color [H]'s [area_string] with \the [src].</span>")
if(area == "mouth")
color_hair(H,1)
else
color_hair(H)
else
to_chat(user, "<span class='notice'>\The [M] doesn't seem to have any hair!</span>")
/obj/item/weapon/hair_dye/proc/color_hair(mob/living/carbon/human/H, var/facial = 0)
if(!H)
return
if(facial)
H.r_facial = color_r
H.g_facial = color_g
H.b_facial = color_b
else
H.r_hair = color_r
H.g_hair = color_g
H.b_hair = color_b
H.update_hair()
playsound(get_turf(src), 'sound/effects/spray2.ogg', 50, 1, -6)
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment