mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
[MIRROR] More GAGS debug and color select improvement (#6144)
* Improved GAGS debug (#59392) * More GAGS debug and color select improvement Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
This commit is contained in:
co-authored by
Emmett Gaines
parent
85674806a5
commit
e27ce8d4fd
@@ -146,6 +146,16 @@
|
||||
split_colors[group] = new_color
|
||||
queue_refresh()
|
||||
|
||||
if("random_color")
|
||||
var/group = text2num(params["color_index"])
|
||||
randomize_color(group)
|
||||
queue_refresh()
|
||||
|
||||
if("random_all_colors")
|
||||
for(var/i in 1 to length(split_colors))
|
||||
randomize_color(i)
|
||||
queue_refresh()
|
||||
|
||||
if("select_icon_state")
|
||||
var/new_icon_state = params["new_icon_state"]
|
||||
if(!config.icon_states[new_icon_state])
|
||||
@@ -183,6 +193,12 @@ This is highly likely to cause a lag spike for a few seconds."},
|
||||
for(var/i in 2 to length(raw_colors))
|
||||
split_colors += "#[raw_colors[i]]"
|
||||
|
||||
/datum/greyscale_modify_menu/proc/randomize_color(color_index)
|
||||
var/new_color = "#"
|
||||
for(var/i in 1 to 3)
|
||||
new_color += num2hex(rand(0, 255), 2)
|
||||
split_colors[color_index] = new_color
|
||||
|
||||
/datum/greyscale_modify_menu/proc/queue_refresh()
|
||||
refreshing = TRUE
|
||||
addtimer(CALLBACK(src, .proc/refresh_preview), 1 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE)
|
||||
@@ -205,24 +221,30 @@ This is highly likely to cause a lag spike for a few seconds."},
|
||||
icon_state = pick(generated_icon_states)
|
||||
|
||||
var/image/finished
|
||||
var/time_spent = TICK_USAGE
|
||||
if(!generate_full_preview)
|
||||
finished = image(config.GenerateBundle(used_colors), icon_state=icon_state)
|
||||
time_spent = TICK_USAGE - time_spent
|
||||
else
|
||||
var/list/data = config.GenerateDebug(used_colors.Join())
|
||||
time_spent = TICK_USAGE - time_spent
|
||||
finished = image(data["icon"], icon_state=icon_state)
|
||||
var/list/steps = list()
|
||||
sprite_data["steps"] = steps
|
||||
for(var/step in data["steps"])
|
||||
CHECK_TICK
|
||||
var/image/layer = image(data["steps"][step])
|
||||
var/image/result = image(step)
|
||||
var/list/step_data = data["steps"][step]
|
||||
var/image/layer = image(step)
|
||||
var/image/result = step_data["result"]
|
||||
steps += list(
|
||||
list(
|
||||
"layer"=icon2html(layer, user, dir=sprite_dir, sourceonly=TRUE),
|
||||
"result"=icon2html(result, user, dir=sprite_dir, sourceonly=TRUE)
|
||||
"result"=icon2html(result, user, dir=sprite_dir, sourceonly=TRUE),
|
||||
"config_name"=step_data["config_name"]
|
||||
)
|
||||
)
|
||||
|
||||
sprite_data["time_spent"] = TICK_DELTA_TO_MS(time_spent)
|
||||
sprite_data["finished"] = icon2html(finished, user, dir=sprite_dir, sourceonly=TRUE)
|
||||
refreshing = FALSE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user