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

Core: move region and location management to worlds #4028

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alwaysintreble
Copy link
Collaborator

What is this fixing or adding?

This moves the region, location, and entrance caches to all be per world. There's a layer of back compatibility so all of the multiworld related helpers still work, and multiworld.regions access still works. latter will need to be deprecated and dropped eventually but unsure if any of the helpers need to be removed, as I haven't looked too deeply into all the core usages of them.

todo:
The RegionManager class should be moved to no longer be locally defined under MultiWorld still, but I think the others are fine where they are. Some typing also needs to be fixed, but I'd rather make sure this is fully tested and functional and looks how we want it to before worrying too much about this. Some tests need to be fixed for the changes due to the way they create their multiworlds/worlds.

How was this tested?

A bunch of generations with solo Messenger, multiworld, and item link generations.

If this makes graphical changes, please attach screenshots.

@github-actions github-actions bot added the affects: core Issues/PRs that touch core and may need additional validation. label Oct 4, 2024
@@ -98,34 +98,42 @@ def __getitem__(self, player) -> bool:
return self.rule(player)

class RegionManager:
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have an opportunity here to make it so when a world gets a location/region/entrance out of this, type-checkers and IDEs can know which subclass it is, and know about properties that are on that game's object.

class RegionManager(Generic[_T_Reg, _T_Ent, _T_Loc]):

in the world:

regions: "MultiWorld.RegionManager[MessengerRegion, MessengerEntrance, MessengerLocation]"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants