From 1fe0d9a697c9e177ee50dd6cafd93ae877ad99ba Mon Sep 17 00:00:00 2001 From: Akrilla Date: Tue, 3 Sep 2019 06:34:40 +0100 Subject: [PATCH] Spray cans can't be set to extremely dark colours (#46213) * no dark * lighter * limit only affects objs * fix --- code/game/objects/items/crayons.dm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index e17f88b2832..3a4e499c784 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -233,8 +233,13 @@ paint_mode = PAINT_NORMAL if("select_colour") if(can_change_colour) - paint_color = input(usr,"","Choose Color",paint_color) as color|null - . = TRUE + var/chosen_colour = input(usr,"","Choose Color",paint_color) as color|null + + if (!isnull(chosen_colour)) + paint_color = chosen_colour + . = TRUE + else + . = FALSE if("enter_text") var/txt = stripped_input(usr,"Choose what to write.", "Scribbles",default = text_buffer) @@ -661,12 +666,18 @@ if(isobj(target)) if(actually_paints) + if(color_hex2num(paint_color) < 350 && !istype(target, /obj/structure/window)) //Colors too dark are rejected + to_chat(usr, "A colour that dark on an object like this? Surely not...") + return FALSE + target.add_atom_colour(paint_color, WASHABLE_COLOUR_PRIORITY) + if(istype(target, /obj/structure/window)) if(color_hex2num(paint_color) < 255) target.set_opacity(255) else target.set_opacity(initial(target.opacity)) + . = use_charges(user, 2) var/fraction = min(1, . / reagents.maximum_volume) reagents.reaction(target, TOUCH, fraction * volume_multiplier)