mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
## About The Pull Request 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.  <details><summary>Mappers rejoice!</summary>   </details> <details><summary>Uses iconforge so it does not take up much time during init</summary>  </details> --- ### Copied from https://github.com/tgstation/tgstation/pull/86482 as 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 ## Why It's Good For The Game No more error icons in SDMM and loadout. ## Changelog 🆑 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>
42 lines
2.6 KiB
Plaintext
42 lines
2.6 KiB
Plaintext
/// Makes sure items using GAGS have all the icon states needed to work
|
|
/datum/unit_test/greyscale_item_icon_states
|
|
|
|
/datum/unit_test/greyscale_item_icon_states/Run()
|
|
for(var/obj/item/item_path as anything in subtypesof(/obj/item))
|
|
if(isnull(initial(item_path.greyscale_colors)))
|
|
continue //All configs depend on greyscale_colors being defined.
|
|
var/held_icon_state = initial(item_path.inhand_icon_state) || initial(item_path.post_init_icon_state)
|
|
|
|
var/datum/greyscale_config/lefthand = SSgreyscale.configurations["[initial(item_path.greyscale_config_inhand_left)]"]
|
|
if(lefthand && !lefthand.icon_states[held_icon_state])
|
|
TEST_FAIL("[lefthand.DebugName()] is missing a sprite for the held lefthand for [item_path]. Expected icon state: '[held_icon_state]'")
|
|
|
|
var/datum/greyscale_config/righthand = SSgreyscale.configurations["[initial(item_path.greyscale_config_inhand_right)]"]
|
|
if(righthand && !righthand.icon_states[held_icon_state])
|
|
TEST_FAIL("[righthand.DebugName()] is missing a sprite for the held righthand for [item_path]. Expected icon state: '[held_icon_state]'")
|
|
|
|
var/datum/greyscale_config/worn = SSgreyscale.configurations["[initial(item_path.greyscale_config_worn)]"]
|
|
var/worn_icon_state = initial(item_path.worn_icon_state) || initial(item_path.post_init_icon_state)
|
|
if(worn && !worn.icon_states[worn_icon_state])
|
|
TEST_FAIL("[worn.DebugName()] is missing a sprite for the worn overlay for [item_path]. Expected icon state: '[worn_icon_state]'")
|
|
|
|
var/datum/greyscale_config/belt = SSgreyscale.configurations["[initial(item_path.greyscale_config_belt)]"]
|
|
var/inside_belt_icon_state = initial(item_path.inside_belt_icon_state) || initial(item_path.icon_state)
|
|
if(belt && !belt.icon_states[inside_belt_icon_state])
|
|
TEST_FAIL("[belt.DebugName()] is missing a sprite for the belt overlay for [item_path]. Expected icon state: '[inside_belt_icon_state]'")
|
|
|
|
/// Makes sure objects using greyscale configs have, if any, the correct number of colors
|
|
/datum/unit_test/greyscale_color_count
|
|
|
|
/datum/unit_test/greyscale_color_count/Run()
|
|
for(var/atom/thing as anything in subtypesof(/atom))
|
|
var/datum/greyscale_config/config = SSgreyscale.configurations["[initial(thing.greyscale_config)]"]
|
|
if(!config)
|
|
continue
|
|
var/list/colors = splittext(initial(thing.greyscale_colors), "#")
|
|
if(!length(colors))
|
|
continue
|
|
var/number_of_colors = length(colors) - 1
|
|
if(config.expected_colors != number_of_colors)
|
|
TEST_FAIL("[thing] has the wrong amount of colors configured for [config.DebugName()]. Expected [config.expected_colors] colors but found [number_of_colors].")
|