mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +01:00
[ready] adds unit test for missing inhand icons. fixes a bunch of missing inhand icons (#70037)
fix: Fixed a bunch of missing inhand icons. fix: Fixed cables in electrical toolboxes not randomizing their colors. fix: Fixed the wrong colored icon showing when trying to make cable cuffs out of cables. fix: The collectable SWAT helmet is now using the proper icon again! refactor: Pipecleaners and power cables now share a unified color system, so they're once again available in ALL the same colors. imageadd: Updated the screwdriver belt overlay to represent the newer sprite. imageadd: Added a bunch of new inhand icons. Special thanks to Twaticus for doing the helmets! <3 fix: Wirecutters now have an icon when inside a belt again! admin: Added a new omnitool subtype that allows you to spawn all items in a typepath! fix: Explorer gaskmasks now properly reflect their adjusted state when held. fix: Fixed balaclavas having the wrong icon when pulled up. fix: Fixed the base energy sword (admin spawn only) being invisible. fix: The rainbow energy sword is now a little bit more rainbowy! fix: Fixed an tk exploit with orange handcuffed shoes. fix: The traitor outfit in the select equipment panel is now actually functional!
This commit is contained in:
@@ -110,6 +110,7 @@
|
||||
#include "hydroponics_harvest.dm"
|
||||
#include "hydroponics_self_mutations.dm"
|
||||
#include "hydroponics_validate_genes.dm"
|
||||
#include "inhands.dm"
|
||||
#include "keybinding_init.dm"
|
||||
#include "knockoff_component.dm"
|
||||
#include "limbsanity.dm"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
for(var/datum/job/one_two_three as anything in subtypesof(/datum/job))
|
||||
var/datum/job/can_you_hear_this = SSjob.GetJobType(one_two_three)
|
||||
if(!can_you_hear_this)
|
||||
log_world("Job type [one_two_three] could not be retrieved from SSjob")
|
||||
log_test("\tJob type [one_two_three] could not be retrieved from SSjob")
|
||||
continue
|
||||
lad.job = can_you_hear_this
|
||||
lad.dress_up_as_job(can_you_hear_this, TRUE)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
/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.icon_state)
|
||||
|
||||
var/datum/greyscale_config/lefthand = SSgreyscale.configurations["[initial(item_path.greyscale_config_inhand_left)]"]
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/// Makes sure items with defined inhand_icon_states... actually have icons that exist!
|
||||
/datum/unit_test/defined_inhand_icon_states
|
||||
var/static/list/possible_icon_states = list()
|
||||
var/fallback_log_message
|
||||
var/unset_inhand_var_message
|
||||
|
||||
/datum/unit_test/defined_inhand_icon_states/proc/generate_possible_icon_states_list(directory_path)
|
||||
if(!directory_path)
|
||||
directory_path = "icons/mob/inhands/"
|
||||
for(var/file_path in flist(directory_path))
|
||||
if(findtext(file_path, ".dmi"))
|
||||
for(var/sprite_icon in icon_states("[directory_path][file_path]", 1)) //2nd arg = 1 enables 64x64+ icon support, otherwise you'll end up with "sword0_1" instead of "sword"
|
||||
possible_icon_states[sprite_icon] += list("[directory_path][file_path]")
|
||||
else
|
||||
possible_icon_states += generate_possible_icon_states_list("[directory_path][file_path]")
|
||||
|
||||
/datum/unit_test/defined_inhand_icon_states/Run()
|
||||
generate_possible_icon_states_list()
|
||||
|
||||
for(var/obj/item/item_path as anything in subtypesof(/obj/item))
|
||||
if(initial(item_path.item_flags) & ABSTRACT)
|
||||
continue
|
||||
|
||||
var/skip_left
|
||||
var/skip_right
|
||||
if(initial(item_path.greyscale_colors)) //greyscale stuff has it's own unit test.
|
||||
skip_left = initial(item_path.greyscale_config_inhand_left)
|
||||
skip_right = initial(item_path.greyscale_config_inhand_right)
|
||||
if(skip_left && skip_right)
|
||||
continue
|
||||
|
||||
var/lefthand_file = initial(item_path.lefthand_file)
|
||||
var/righthand_file = initial(item_path.righthand_file)
|
||||
|
||||
var/held_icon_state = initial(item_path.inhand_icon_state)
|
||||
if(!held_icon_state)
|
||||
var/base_icon_state = initial(item_path.icon_state)
|
||||
if(!isnull(base_icon_state) && lefthand_file && righthand_file) //Suggest inhand icons that match with the icon_state var.
|
||||
var/missing_var_message
|
||||
if(base_icon_state in possible_icon_states)
|
||||
for(var/file_place in possible_icon_states[base_icon_state])
|
||||
missing_var_message += (missing_var_message ? " & '[file_place]'" : " - Possible matching sprites for \"[base_icon_state]\" found in: '[file_place]'")
|
||||
unset_inhand_var_message += "\n\t[item_path] does not have an inhand_icon_state value[missing_var_message]"
|
||||
continue
|
||||
|
||||
var/match_message = (held_icon_state in possible_icon_states) ? TRUE : null
|
||||
if(match_message)
|
||||
match_message = null
|
||||
for(var/file_place in possible_icon_states[held_icon_state])
|
||||
match_message += (match_message ? " & '[file_place]'" : " - Matching sprite found in: '[file_place]'")
|
||||
|
||||
if(!(skip_left || skip_right) && !lefthand_file && !righthand_file)
|
||||
TEST_FAIL("Missing both icon files for [item_path].\n\tinhand_icon_state = \"[held_icon_state]\"[match_message]")
|
||||
continue
|
||||
|
||||
var/missing_left
|
||||
var/left_fallback
|
||||
if(!skip_left)
|
||||
if(!lefthand_file)
|
||||
TEST_FAIL("Missing left inhand icon file for [item_path].\n\tinhand_icon_state = \"[held_icon_state]\"[match_message]")
|
||||
else
|
||||
missing_left = !("[lefthand_file]" in possible_icon_states[held_icon_state])
|
||||
if(missing_left && ("[lefthand_file]" in possible_icon_states[""]))
|
||||
left_fallback = TRUE
|
||||
|
||||
var/missing_right
|
||||
var/right_fallback
|
||||
if(!skip_right)
|
||||
if(!righthand_file)
|
||||
TEST_FAIL("Missing right inhand icon file for [item_path].\n\tinhand_icon_state = \"[held_icon_state]\"[match_message]")
|
||||
else
|
||||
missing_right = !("[righthand_file]" in possible_icon_states[held_icon_state])
|
||||
if(missing_right && ("[righthand_file]" in possible_icon_states[""]))
|
||||
right_fallback = TRUE
|
||||
|
||||
if(missing_right && missing_left)
|
||||
if(!match_message && right_fallback && left_fallback)
|
||||
fallback_log_message += "\n\t[item_path] has invalid value, using fallback icon.\n\tinhand_icon_state = \"[held_icon_state]\""
|
||||
continue
|
||||
TEST_FAIL("Missing inhand sprites for [item_path] in both '[lefthand_file]' & '[righthand_file]'.\n\tinhand_icon_state = \"[held_icon_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\tinhand_icon_state = \"[held_icon_state]\"[match_message]")
|
||||
else if(missing_right)
|
||||
TEST_FAIL("Missing right inhand sprite for [item_path] in '[righthand_file]'[right_fallback ? ", using fallback icon" : null].\n\tinhand_icon_state = \"[held_icon_state]\"[match_message]")
|
||||
|
||||
if(fallback_log_message)
|
||||
TEST_FAIL("Invalid inhand_icon_state values should be set to null if there isn't a valid icon.[fallback_log_message]")
|
||||
|
||||
if(unset_inhand_var_message)
|
||||
log_test("\tNotice - Possible inhand icon matches found. It is best to be explicit with inhand sprite values.[unset_inhand_var_message]")
|
||||
|
||||
@@ -97,7 +97,7 @@ GLOBAL_LIST_EMPTY(unit_test_mapping_logs)
|
||||
if (fexists(filename))
|
||||
var/data_filename = "data/screenshots/[path_prefix]_[name].png"
|
||||
fcopy(icon, data_filename)
|
||||
log_test("[path_prefix]_[name] was found, putting in data/screenshots")
|
||||
log_test("\t[path_prefix]_[name] was found, putting in data/screenshots")
|
||||
else if (fexists("code"))
|
||||
// We are probably running in a local build
|
||||
fcopy(icon, filename)
|
||||
@@ -106,7 +106,7 @@ GLOBAL_LIST_EMPTY(unit_test_mapping_logs)
|
||||
// We are probably running in real CI, so just pretend it worked and move on
|
||||
fcopy(icon, "data/screenshots_new/[path_prefix]_[name].png")
|
||||
|
||||
log_test("[path_prefix]_[name] was put in data/screenshots_new")
|
||||
log_test("\t[path_prefix]_[name] was put in data/screenshots_new")
|
||||
|
||||
/// Logs a test message. Will use GitHub action syntax found at https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
|
||||
/datum/unit_test/proc/log_for_test(text, priority, file, line)
|
||||
|
||||
Reference in New Issue
Block a user