mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-18 05:32:58 +00:00
This fix was one hell of a debug journey. Icon.Insert() was the issue here but I'm not sure if it counts as byond bug in this particular case. When you insert a single frame icon, if an existing icon state of the same name exists normally it would be overridden. However different things happen if the icon that gets overridden has multiple frames. I'm not fully sure of the different behaviors but depending on what the icons consisted of you could get animated sprites where every frame was the same or appending frames to animated sprites in strange ways. This has been fixed by making sure no Inserts are overriding existing icon states so that the strange behavior doesn't have to be dealt with. The GAGS debug menu has been upgraded a bit on the way to fixing this bug. A toggle to automatically refresh icons when the dmi or json configuration are updated has been added and the step by step preview will only show steps now involved in the creation of the icon state you select.
51 lines
2.0 KiB
Plaintext
51 lines
2.0 KiB
Plaintext
PROCESSING_SUBSYSTEM_DEF(greyscale)
|
|
name = "Greyscale"
|
|
flags = SS_BACKGROUND
|
|
init_order = INIT_ORDER_GREYSCALE
|
|
wait = 3 SECONDS
|
|
|
|
var/list/datum/greyscale_config/configurations = list()
|
|
var/list/datum/greyscale_layer/layer_types = list()
|
|
|
|
/datum/controller/subsystem/processing/greyscale/Initialize(start_timeofday)
|
|
for(var/datum/greyscale_layer/fake_type as anything in subtypesof(/datum/greyscale_layer))
|
|
layer_types[initial(fake_type.layer_type)] = fake_type
|
|
|
|
for(var/greyscale_type in subtypesof(/datum/greyscale_config))
|
|
var/datum/greyscale_config/config = new greyscale_type()
|
|
configurations["[greyscale_type]"] = config
|
|
|
|
// We do this after all the types have been loaded into the listing so reference layers don't care about init order
|
|
for(var/greyscale_type in configurations)
|
|
CHECK_TICK
|
|
var/datum/greyscale_config/config = configurations[greyscale_type]
|
|
config.Refresh()
|
|
|
|
// This final verification step is for things that need other greyscale configurations to be finished loading
|
|
for(var/greyscale_type as anything in configurations)
|
|
CHECK_TICK
|
|
var/datum/greyscale_config/config = configurations[greyscale_type]
|
|
config.CrossVerify()
|
|
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/processing/greyscale/proc/RefreshConfigsFromFile()
|
|
for(var/i in configurations)
|
|
configurations[i].Refresh(TRUE)
|
|
|
|
/datum/controller/subsystem/processing/greyscale/proc/GetColoredIconByType(type, list/colors)
|
|
if(!ispath(type, /datum/greyscale_config))
|
|
CRASH("An invalid greyscale configuration was given to `GetColoredIconByType()`: [type]")
|
|
type = "[type]"
|
|
if(istype(colors)) // It's the color list format
|
|
colors = colors.Join()
|
|
else if(!istext(colors))
|
|
CRASH("Invalid colors were given to `GetColoredIconByType()`: [colors]")
|
|
return configurations[type].Generate(colors)
|
|
|
|
/datum/controller/subsystem/processing/greyscale/proc/ParseColorString(color_string)
|
|
. = list()
|
|
var/list/split_colors = splittext(color_string, "#")
|
|
for(var/color in 2 to length(split_colors))
|
|
. += "#[split_colors[color]]"
|