Skip to content

Conversation

@nicopop
Copy link
Contributor

@nicopop nicopop commented May 12, 2025

Seems the item_counts was made too late and for some reason UT and only UT couldn't see the precollected items
by creating it at the start of set_rules UT can now see precollected items too

this makes it work with both game.json's starting_items and the player yamls's start_inventory and start_inventory_from_pool
in start_inventory case item are added to the pool and just added to the counts thus for :all and any :% will grow with the items
but start_inventory_from_pool should now work correctly since the items already exists

the only way this will break is if a custom rule made in the rules.py hook call the reset of the item count cache and thus break UT again
Im not sure the best way to prevent that from happening, could potential create an invalid player in the cache (-1) and test for it and not reset if present or something

@nicopop nicopop self-assigned this May 12, 2025
Copy link
Collaborator

@FuzzyGamesOn FuzzyGamesOn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good addition 😄

@silasary silasary merged commit 1095371 into main May 13, 2025
@nicopop nicopop deleted the fix_rules_item_counts branch May 13, 2025 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants