Files
Paradise/code/game/machinery/dye_generator.dm
AffectedArc07 03cca11f95 Init Sanity Unit Test (#25442)
* Init Sanity Unit Test

* Oops

* Update code/modules/unit_tests/init_sanity.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Signed-off-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

* Makes noticeboard less silly

---------

Signed-off-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
2024-05-23 19:43:33 +00:00

130 lines
3.5 KiB
Plaintext

/obj/machinery/dye_generator
name = "Dye Generator"
icon = 'icons/obj/vending.dmi'
icon_state = "barbervend"
density = TRUE
anchored = TRUE
integrity_failure = 100
idle_power_consumption = 40
var/dye_color = "#FFFFFF"
/obj/machinery/dye_generator/Initialize()
. = ..()
power_change()
/obj/machinery/dye_generator/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/metal(loc, 3)
qdel(src)
/obj/machinery/dye_generator/power_change()
if(has_power() && anchored)
stat &= ~NOPOWER
set_light(2, l_color = dye_color)
else
stat |= NOPOWER
set_light(0)
update_icon(UPDATE_OVERLAYS)
/obj/machinery/dye_generator/extinguish_light(force = FALSE)
set_light(0)
underlays.Cut()
/obj/machinery/dye_generator/update_overlays()
. = ..()
underlays.Cut()
if(stat & (BROKEN|NOPOWER))
. += "barbervend_off"
if(stat & BROKEN)
. += "barbervend_broken"
if(light)
underlays += emissive_appearance(icon, "barbervend_lightmask")
/obj/machinery/dye_generator/attack_hand(mob/user)
..()
src.add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
return
var/temp = input(usr, "Choose a dye color", "Dye Color") as color
dye_color = temp
set_light(2, l_color = temp)
/obj/machinery/dye_generator/attackby(obj/item/I, mob/user, params)
if(default_unfasten_wrench(user, I, time = 60))
return
if(istype(I, /obj/item/hair_dye_bottle))
var/obj/item/hair_dye_bottle/HD = I
user.visible_message("<span class='notice'>[user] fills [HD] up with some dye.</span>","<span class='notice'>You fill [HD] up with some hair dye.</span>")
HD.dye_color = dye_color
HD.update_icon()
return
return ..()
/obj/machinery/dye_generator/obj_break(damage_flag)
if(!(stat & BROKEN))
stat |= BROKEN
update_icon(UPDATE_OVERLAYS)
//Hair Dye Bottle
/obj/item/hair_dye_bottle
name = "hair dye bottle"
desc = "A refillable bottle used for holding hair dyes of all sorts of colors."
icon = 'icons/obj/items.dmi'
icon_state = "hairdyebottle"
throwforce = 0
throw_speed = 4
throw_range = 7
force = 0
w_class = WEIGHT_CLASS_TINY
var/dye_color = "#FFFFFF"
/obj/item/hair_dye_bottle/New()
..()
update_icon(UPDATE_OVERLAYS)
/obj/item/hair_dye_bottle/update_overlays()
. = ..()
var/image/I = new('icons/obj/items.dmi', "hairdyebottle-overlay")
I.color = dye_color
. += I
/obj/item/hair_dye_bottle/attack(mob/living/carbon/M, mob/user)
if(user.a_intent != INTENT_HELP)
..()
return
if(!(M in view(1)))
..()
return
if(ishuman(M))
var/mob/living/carbon/human/H = M
var/dye_list = list("hair", "alt. hair theme")
if(H.gender == MALE || isvulpkanin(H))
dye_list += "facial hair"
dye_list += "alt. facial hair theme"
if(H && (H.dna.species.bodyflags & HAS_SKIN_COLOR))
dye_list += "body"
var/what_to_dye = input(user, "Choose an area to apply the dye", "Dye Application") in dye_list
if(!user.Adjacent(M))
to_chat(user, "You are too far away!")
return
user.visible_message("<span class='notice'>[user] starts dying [M]'s [what_to_dye]!</span>", "<span class='notice'>You start dying [M]'s [what_to_dye]!</span>")
if(do_after(user, 50, target = H))
switch(what_to_dye)
if("hair")
H.change_hair_color(dye_color)
if("alt. hair theme")
H.change_hair_color(dye_color, 1)
if("facial hair")
H.change_facial_hair_color(dye_color)
if("alt. facial hair theme")
H.change_facial_hair_color(dye_color, 1)
if("body")
H.change_skin_color(dye_color)
H.update_dna()
user.visible_message("<span class='notice'>[user] finishes dying [M]'s [what_to_dye]!</span>", "<span class='notice'>You finish dying [M]'s [what_to_dye]!</span>")