Skip to content

Commit

Permalink
prob a cleaner way to do this
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Sep 19, 2024
1 parent 3f5f71e commit faf2610
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ jobs:
matrix:
arg: [
"BASIC_TESTS",
"EXTRA_ICON_TESTS",
"CREATE_AND_DESTROY_TEST",
"PLANET_GEN_TEST",
"RUIN_PLACEMENT_TEST",
Expand Down
17 changes: 5 additions & 12 deletions code/modules/unit_tests/_unit_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
#define TEST_OUTPUT_GREEN(text) (text)
#endif

#define EXTRA_ICON_TESTS

#ifdef BASIC_TESTS

#ifndef EXTRA_ICON_TESTS
#include "icons/missing_icons.dm"
#include "icons/spritesheets.dm"
#include "icons/worn_icons.dm"
#endif //EXTRA_ICON_TESTS

#include "icons/worn_icons.dm
#ifdef EXTRA_ICON_TESTS
#include "icons/inhands.dm"
#endif //EXTRA_ICON_TESTS"
#include "anchored_mobs.dm"
#include "autowiki.dm"
#include "bespoke_id.dm"
Expand Down Expand Up @@ -116,13 +116,6 @@

#endif //BASIC_TESTS

#ifdef EXTRA_ICON_TESTS
#include "icons/inhands.dm"
#include "icons/missing_icons.dm"
#include "icons/spritesheets.dm"
#include "icons/worn_icons.dm"
#endif //EXTRA_ICON_TESTS

#ifdef CREATE_AND_DESTROY_TEST
#include "create_and_destroy.dm"
#endif //CREATE_AND_DESTROY_TEST
Expand Down
6 changes: 3 additions & 3 deletions code/modules/unit_tests/icons/inhands.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
match_message += (match_message ? " & '[file_place]'" : " - Matching sprite found in: '[file_place]'")

if(!(skip_left || skip_right) && !lefthand_file && !righthand_file)
WARNING("Missing both icon files for [item_path].\n\titem_state = \"[item_state]\"[match_message]")
log_world("Missing both icon files for [item_path].\n\titem_state = \"[item_state]\"[match_message]")
continue

var/missing_left
Expand All @@ -80,7 +80,7 @@
if(!match_message && right_fallback && left_fallback)
fallback_log_message += "\n\t[item_path] has invalid value, using fallback icon.\n\titem_state = \"[item_state]\""
continue
WARNING("Missing inhand sprites for [item_path] in both '[lefthand_file]' & '[righthand_file]'.\n\titem_state = \"[item_state]\"[match_message]")
log_world("Missing inhand sprites for [item_path] in both '[lefthand_file]' & '[righthand_file]'.\n\titem_state = \"[item_state]\"[match_message]")
else if(missing_left)
TEST_FAIL("Missing left inhand sprite for [item_path] in '[lefthand_file]'[left_fallback ? ", using fallback icon" : null].\n\titem_state = \"[item_state]\"[match_message]")
else if(missing_right)
Expand All @@ -90,5 +90,5 @@
TEST_FAIL("Invalid item_state values should be set to null if there isn't a valid icon.[fallback_log_message]")

if(unset_inhand_var_message)
WARNING("\tNotice - Possible inhand icon matches found. It is best to be explicit with inhand sprite values.[unset_inhand_var_message]")
log_world("\tNotice - Possible inhand icon matches found. It is best to be explicit with inhand sprite values.[unset_inhand_var_message]")

8 changes: 1 addition & 7 deletions code/modules/unit_tests/icons/missing_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,22 @@
var/obj/item/item_path = obj_path
if(initial(item_path.item_flags) & ABSTRACT)
continue

#ifdef EXTRA_ICON_TESTS
if(ispath(obj_path, /obj/item))
if(ispath(obj_path, /obj/item/melee))
if(obj_path != /obj/item/melee/sword/supermatter)
var/obj/item/melee/melee_item = new item_path()
if(melee_item.GetComponent(/datum/component/two_handed))
search_for_w = TRUE
if(melee_item.GetComponent(/datum/component/transforming))
search_for_on = TRUE
#endif

var/icon = initial(obj_path.icon)
var/init_icon_path = initial(obj_path.icon_state)
icons_to_find += init_icon_path

#ifdef EXTRA_ICON_TESTS
if(!isnull(init_icon_path))
if(search_for_w)
icons_to_find += "[init_icon_path]_w"
if(search_for_on)
icons_to_find += "[init_icon_path]_on"
#endif

for(var/icon_state in icons_to_find)
if(isnull(icon))
Expand Down

0 comments on commit faf2610

Please sign in to comment.