mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Migrate hair dye bottles to the new attack chain and tgui. (#32306)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/obj/machinery/dye_generator
|
||||
name = "Dye Generator"
|
||||
desc = "A machine that synthesizes dye. Simply pick the color of your dreams and insert a dye bottle to dispense."
|
||||
icon = 'icons/obj/vending.dmi'
|
||||
icon_state = "barbervend"
|
||||
density = TRUE
|
||||
@@ -41,7 +42,7 @@
|
||||
|
||||
/obj/machinery/dye_generator/attack_hand(mob/user)
|
||||
..()
|
||||
src.add_fingerprint(user)
|
||||
add_fingerprint(user)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
var/temp = tgui_input_color(user, "Please select a dye color", "Dye Color")
|
||||
@@ -49,6 +50,11 @@
|
||||
return
|
||||
dye_color = temp
|
||||
set_light(2, l_color = temp)
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("The light on [src] changes to show a new dye color."),
|
||||
SPAN_NOTICE("You set [src] to dispense the new dye color."),
|
||||
SPAN_HEAR("[src] whirrs quietly as it prepares to dispense a new dye color.")
|
||||
)
|
||||
|
||||
/obj/machinery/dye_generator/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
||||
if(default_unfasten_wrench(user, used, time = 60))
|
||||
@@ -56,9 +62,14 @@
|
||||
|
||||
if(istype(used, /obj/item/hair_dye_bottle))
|
||||
var/obj/item/hair_dye_bottle/HD = used
|
||||
user.visible_message(SPAN_NOTICE("[user] fills [HD] up with some dye."),SPAN_NOTICE("You fill [HD] up with some hair dye."))
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("[user] fills [HD] up with some dye."),
|
||||
SPAN_NOTICE("You fill [HD] up with some hair dye."),
|
||||
SPAN_HEAR("You hear a [src] dispensing hair foam.")
|
||||
)
|
||||
HD.dye_color = dye_color
|
||||
HD.update_icon()
|
||||
HD.add_fingerprint(user)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
return ..()
|
||||
@@ -77,6 +88,7 @@
|
||||
throw_speed = 4
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
var/dye_color = "#FFFFFF"
|
||||
new_attack_chain = TRUE
|
||||
|
||||
/obj/item/hair_dye_bottle/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -88,40 +100,59 @@
|
||||
I.color = dye_color
|
||||
. += I
|
||||
|
||||
/obj/item/hair_dye_bottle/attack__legacy__attackchain(mob/living/carbon/M, mob/user)
|
||||
/obj/item/hair_dye_bottle/interact_with_atom(mob/living/carbon/human/target, mob/living/user, list/modifiers)
|
||||
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")
|
||||
return ..()
|
||||
|
||||
if(H.gender == MALE || isvulpkanin(H))
|
||||
dye_list += "facial hair"
|
||||
dye_list += "alt. facial hair theme"
|
||||
if(!ishuman(target))
|
||||
return ..()
|
||||
|
||||
if(H && (H.dna.species.bodyflags & HAS_SKIN_COLOR))
|
||||
dye_list += "body"
|
||||
var/dye_list = list()
|
||||
var/obj/item/organ/external/head/head_organ = target.get_organ("head")
|
||||
|
||||
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_NOTICE("[user] starts dying [M]'s [what_to_dye]!"), SPAN_NOTICE("You start dying [M]'s [what_to_dye]!"))
|
||||
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_NOTICE("[user] finishes dying [M]'s [what_to_dye]!"), SPAN_NOTICE("You finish dying [M]'s [what_to_dye]!"))
|
||||
if(head_organ && !(head_organ.dna.species.bodyflags & BALD))
|
||||
dye_list += "hair"
|
||||
dye_list += "alt. hair theme"
|
||||
|
||||
if(head_organ && !(head_organ.dna.species.bodyflags & SHAVED))
|
||||
dye_list += "facial hair"
|
||||
dye_list += "alt. facial hair theme"
|
||||
|
||||
if(target.dna.species.bodyflags & HAS_SKIN_COLOR)
|
||||
dye_list += "body"
|
||||
|
||||
if(!length(dye_list))
|
||||
to_chat(user, SPAN_WARNING("[target] doesn't have any dyeable features!"))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
var/what_to_dye = tgui_input_list(user, "Choose an area to apply the dye", "Dye Application", dye_list)
|
||||
if(!user.Adjacent(target))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
if(!(what_to_dye in dye_list))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("[user] starts dyeing [target]'s [what_to_dye]!"),
|
||||
SPAN_NOTICE("You start dyeing [target]'s [what_to_dye]!")
|
||||
)
|
||||
add_fingerprint(user)
|
||||
if(!do_after(user, 50, target = target))
|
||||
to_chat(user, SPAN_NOTICE("You stop dyeing [target]'s [what_to_dye]."))
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
switch(what_to_dye)
|
||||
if("hair")
|
||||
target.change_hair_color(dye_color)
|
||||
if("alt. hair theme")
|
||||
target.change_hair_color(dye_color, TRUE)
|
||||
if("facial hair")
|
||||
target.change_facial_hair_color(dye_color)
|
||||
if("alt. facial hair theme")
|
||||
target.change_facial_hair_color(dye_color, TRUE)
|
||||
if("body")
|
||||
target.change_skin_color(dye_color)
|
||||
target.update_dna()
|
||||
user.visible_message(
|
||||
SPAN_NOTICE("[user] finishes dyeing [target]'s [what_to_dye]!"),
|
||||
SPAN_NOTICE("You finish dyeing [target]'s [what_to_dye]!")
|
||||
)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
Reference in New Issue
Block a user