Files
Bubberstation/code/game/atom/atom_greyscale.dm
Emmett Gaines eedb505af0 Splits up most of atoms.dm (#79743)
No code changes, just a bunch of moved code to reduce the size of the
main atoms file. Took it from about 2.2k lines to under 1k. Also a
couple of docs changes where it was incorrect.
2023-11-16 23:01:01 +00:00

31 lines
1.2 KiB
Plaintext

/atom
///The config type to use for greyscaled sprites. Both this and greyscale_colors must be assigned to work.
var/greyscale_config
///A string of hex format colors to be used by greyscale sprites, ex: "#0054aa#badcff"
var/greyscale_colors
/// Handles updates to greyscale value updates.
/// The colors argument can be either a list or the full color string.
/// Child procs should call parent last so the update happens after all changes.
/atom/proc/set_greyscale(list/colors, new_config)
SHOULD_CALL_PARENT(TRUE)
if(istype(colors))
colors = colors.Join("")
if(!isnull(colors) && greyscale_colors != colors) // If you want to disable greyscale stuff then give a blank string
greyscale_colors = colors
if(!isnull(new_config) && greyscale_config != new_config)
greyscale_config = new_config
update_greyscale()
/// Checks if this atom uses the GAGS system and if so updates the icon
/atom/proc/update_greyscale()
SHOULD_CALL_PARENT(TRUE)
if(greyscale_colors && greyscale_config)
icon = SSgreyscale.GetColoredIconByType(greyscale_config, greyscale_colors)
if(!smoothing_flags) // This is a bitfield but we're just checking that some sort of smoothing is happening
return
update_atom_colour()
QUEUE_SMOOTH(src)