diff --git a/code/game/atoms.dm b/code/game/atoms.dm index d77f1a3b138..8f484ef43c2 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1186,6 +1186,23 @@ atom_colours[colour_priority] = null update_atom_colour() +/** + * Checks if this atom has the passed color + * Can optionally be supplied with a range of priorities, IE only checking "washable" or above + */ +/atom/proc/is_atom_colour(looking_for_color, min_priority_index = 1, max_priority_index = COLOUR_PRIORITY_AMOUNT) + // make sure uppertext hex strings don't mess with lowertext hex strings + looking_for_color = lowertext(looking_for_color) + + if(!LAZYLEN(atom_colours)) + // no atom colors list has been set up, just check the color var + return lowertext(color) == looking_for_color + + for(var/i in min_priority_index to max_priority_index) + if(lowertext(atom_colours[i]) == looking_for_color) + return TRUE + + return FALSE ///Resets the atom's color to null, and then sets it to the highest priority colour available /atom/proc/update_atom_colour() diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 724b35b80b5..34b60edef13 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -824,8 +824,8 @@ var/fraction = min(1, . / reagents.maximum_volume) reagents.expose(carbon_target, VAPOR, fraction * volume_multiplier) - else if(actually_paints && target.atom_colours[atom_colours] == paint_color) - balloon_alert(user, "[target.p_theyre()] already of that color.") + else if(actually_paints && target.is_atom_colour(paint_color, min_priority_index = WASHABLE_COLOUR_PRIORITY)) + balloon_alert(user, "[target.p_theyre()] already that color!") return FALSE if(ismob(target) && (HAS_TRAIT(target, TRAIT_SPRAY_PAINTABLE)))