Adds automatic GAGS icon generation for mapping and the loadout menu (#90940)

Revival of https://github.com/tgstation/tgstation/pull/86482, which is
even more doable now that we have rustg iconforge generation.

What this PR does:

- Sets up every single GAGS icon in the game to have their own preview
icon autogenerated during compile. This is configurable to not run
during live. The icons are created in `icons/map_icons/..`
- This also has the side effect of providing accurate GAGS icons for
things like the loadout menu. No more having to create your own
previews.

![FOuGL6ofxC](https://github.com/user-attachments/assets/e5414971-7f13-4883-9f7f-a8a212b46fe8)

<details><summary>Mappers rejoice!</summary>

![StrongDMM_1oeMSoRHXT](https://github.com/user-attachments/assets/83dcfe4c-31be-4953-98f3-dff90268bbc4)

![StrongDMM_uyqu3CggPn](https://github.com/user-attachments/assets/7896f99e-2656-40e1-a9da-3a513882365a)

</details>

<details><summary>Uses iconforge so it does not take up much time during
init</summary>

![dreamdaemon_u4Md3Dqwge](https://github.com/user-attachments/assets/17baaff8-5d5e-4a4d-ba8f-9dd548024155)

</details>

---

this still applies:

Note for Spriters:

After you've assigned the correct values to vars, you must run the game
through init on your local machine and commit the changes to the map
icon dmi files. Unit tests should catch all cases of forgetting to
assign the correct vars, or not running through init.

Note for Server Operators:

In order to not generate these icons on live I've added a new config
entry which should be disabled on live called GENERATE_ASSETS_IN_INIT in
the config.txt

No more error icons in SDMM and loadout.

🆑
refactor: preview icons for greyscale items are now automatically
generated, meaning you can see GAGS as they actually appear ingame while
mapping or viewing the loadout menu.
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
Bloop
2025-05-29 16:14:43 -04:00
committed by Roxy
co-authored by LemonInTheDark
parent 8e52e949af
commit 655b66bdd0
143 changed files with 1199 additions and 446 deletions
+7 -2
View File
@@ -36,8 +36,13 @@
icon_file = style.icon
icon_state = style.icon_state
icon_file ||= initial(preview_item.icon_preview) || initial(preview_item.icon)
icon_state ||= initial(preview_item.icon_state_preview) || initial(preview_item.icon_state)
if(preview_item.greyscale_config)
var/datum/greyscale_config/greyscale_config = preview_item::greyscale_config
icon_file ||= preview_item::icon_preview || greyscale_config::icon_file
icon_state ||= preview_item::icon_state_preview || preview_item::post_init_icon_state || preview_item::icon_state
else
icon_file ||= preview_item::icon_preview || preview_item::icon
icon_state ||= preview_item::icon_state_preview || preview_item::icon_state
if(PERFORM_ALL_TESTS(focus_only/bad_cooking_crafting_icons))
if(!icon_exists_or_scream(icon_file, icon_state))
@@ -12,8 +12,8 @@
var/datum/icon_transformer/transform = null
if(initial(path.research_icon) && initial(path.research_icon_state)) //If the design has an icon replacement skip the rest
icon_file = initial(path.research_icon)
icon_state = initial(path.research_icon_state)
icon_file = path::research_icon
icon_state = path::research_icon_state
if (PERFORM_ALL_TESTS(focus_only/invalid_research_designs))
if(!icon_exists(icon_file, icon_state))
stack_trace("design [path] with icon '[icon_file]' missing state '[icon_state]'")
@@ -37,15 +37,15 @@
item = machine
// GAGS icon short-circuit the rest of the checks
if (initial(item.greyscale_config) && initial(item.greyscale_colors))
insert_icon(initial(path.id), gags_to_universal_icon(item))
if (item::greyscale_config && item::greyscale_colors)
insert_icon(path::id, gags_to_universal_icon(item))
continue
else
icon_file = initial(item.icon)
icon_file = item::icon
icon_state = initial(item.icon_state)
if(initial(item.color))
transform = color_transform(initial(item.color))
icon_state = item::icon_state
if(item::color)
transform = color_transform(item::color)
if (PERFORM_ALL_TESTS(focus_only/invalid_research_designs))
if(!icon_exists(icon_file, icon_state))
stack_trace("design [path] with icon '[icon_file]' missing state '[icon_state]'")
@@ -210,7 +210,7 @@
CRASH("gags_to_universal_icon() received an invalid path of \"[path]\"!")
var/datum/greyscale_config/config = initial(path.greyscale_config)
var/colors = initial(path.greyscale_colors)
var/datum/universal_icon/entry = SSgreyscale.GetColoredIconByTypeUniversalIcon(config, colors, initial(path.icon_state))
var/datum/universal_icon/entry = SSgreyscale.GetColoredIconByTypeUniversalIcon(config, colors, path::post_init_icon_state || path::icon_state)
return entry
/// Gets the relevant universal icon for an atom, when displayed in TGUI. (see: icon_state_preview)