Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional dmi testing for duplicates and quantity #3867

Merged
merged 20 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code/game/objects/items/reagent_containers/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
/// Food.
////////////////////////////////////////////////////////////////////////////////
/obj/item/reagent_container/food
item_icons = list(
WEAR_L_HAND = 'icons/mob/humans/onmob/items_lefthand_1.dmi',
WEAR_R_HAND = 'icons/mob/humans/onmob/items_righthand_1.dmi'
)
possible_transfer_amounts = null
volume = 50 //Sets the default container amount for all food items.
flags_atom = CAN_BE_SYRINGED
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
desc = "Can hold various things."
icon = 'icons/obj/items/clothing/belts.dmi'
icon_state = "utilitybelt"
item_icons = list(
WEAR_L_HAND = 'icons/mob/humans/onmob/items_lefthand_1.dmi',
WEAR_R_HAND = 'icons/mob/humans/onmob/items_righthand_1.dmi'
)
item_state = "utility"
flags_equip_slot = SLOT_WAIST
attack_verb = list("whipped", "lashed", "disciplined")
Expand Down
1 change: 1 addition & 0 deletions code/modules/unit_tests/missing_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/datum/unit_test/missing_icons/Run()
generate_possible_icon_states_list()
generate_possible_icon_states_list("icons/effects/")
generate_possible_icon_states_list("icons/mobs/")
if(additional_icon_location)
generate_possible_icon_states_list(additional_icon_location)

Expand Down
Binary file modified icons/mob/hud/human_old.dmi
Binary file not shown.
Binary file modified icons/mob/humans/onmob/items_lefthand_0.dmi
Binary file not shown.
Binary file modified icons/mob/humans/onmob/items_lefthand_1.dmi
Binary file not shown.
Binary file modified icons/mob/humans/onmob/items_righthand_0.dmi
Binary file not shown.
Binary file modified icons/mob/humans/onmob/items_righthand_1.dmi
Binary file not shown.
Binary file modified icons/obj/structures/props/rocks.dmi
Binary file not shown.
Binary file modified icons/rebase_icons.dmi
Binary file not shown.
Binary file modified icons/turf/floors/desert_dirt.dmi
Binary file not shown.
Binary file modified icons/turf/floors/desert_rock.dmi
Binary file not shown.
37 changes: 34 additions & 3 deletions tools/dmi/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,54 @@
from dmi import *


def green(text):
return "\033[32m" + str(text) + "\033[0m"


def red(text):
return "\033[31m" + str(text) + "\033[0m"


def _self_test():
# test: can we load every DMI in the tree
count = 0
failed = 0
for dirpath, dirnames, filenames in os.walk('.'):
if '.git' in dirnames:
dirnames.remove('.git')
for filename in filenames:
if filename.endswith('.dmi'):
fullpath = os.path.join(dirpath, filename)
failures_this_file = 0
try:
Dmi.from_file(fullpath)
dmi = Dmi.from_file(fullpath)
dmi_states = dmi.states
number_of_icon_states = len(dmi.states)
if number_of_icon_states > 512:
print("{0} {1} has too many icon states: {2}/512.".format(red("FAIL"), fullpath, number_of_icon_states))
failures_this_file += 1
existing_states = []
for state in dmi_states:
state_name = state.name
if state.movement:
state_name += "_MOVEMENT_STATE_TRUE"
if state_name in existing_states:
print("{0} {1} has a duplicate state '{2}'.".format(red("FAIL"), fullpath, state.name))
failures_this_file += 1
continue
existing_states.append(state_name)
except Exception:
print('Failed on:', fullpath)
print("{0} {1} threw an exception.".format(red("FAIL"), fullpath))
failures_this_file += 1
raise
count += 1
if failures_this_file > 0:
failed += 1

print(f"{os.path.relpath(__file__)}: successfully parsed {count} .dmi files")
print(f"{os.path.relpath(__file__)}: {green(f'successfully parsed {count-failed} .dmi files')}")
if failed > 0:
print(f"{os.path.relpath(__file__)}: {red(f'failed to parse {failed} .dmi files')}")
exit(1)


def _usage():
Expand Down