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: prepare worlds.Files for APWorldContainer #4331

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Berserker66
Copy link
Member

@Berserker66 Berserker66 commented Dec 3, 2024

What is this fixing or adding?

Not much on its own.
APContainer is now just any AP related zip file containing an archipelago.json
APPlayerContainer is the old one, aimed at files for a particular slot/player

Follow up PR(s) can then cleanly introduce APWorldContainer(APContainer) with the meta data we desire inside the archipelago.json.

How was this tested?

I ran Factorio gen once and it didn't break

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Dec 3, 2024
worlds/Files.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@beauxq beauxq left a comment

Choose a reason for hiding this comment

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

looked at code and tested generate and patch a game

Copy link
Collaborator

@Silvris Silvris left a comment

Choose a reason for hiding this comment

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

Did not test, but changes appear fine.

Copy link
Contributor

@silasary silasary left a comment

Choose a reason for hiding this comment

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

Code looks good, and successfully generated a Factorio

Copy link
Contributor

@Jouramie Jouramie left a comment

Choose a reason for hiding this comment

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

APContainers is not a system I know very well, but code LGTM.

worlds/Files.py Show resolved Hide resolved
worlds/Files.py Outdated Show resolved Hide resolved
@ScipioWright ScipioWright added is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Jan 10, 2025
@Exempt-Medic Exempt-Medic added the waiting-on: author Issue/PR is waiting for feedback or changes from its author. label Jan 14, 2025
@Exempt-Medic Exempt-Medic removed the waiting-on: author Issue/PR is waiting for feedback or changes from its author. label Jan 14, 2025
@@ -135,31 +126,58 @@ def read(self, file: Optional[Union[str, BinaryIO]] = None) -> None:
message = f"{arg0} - "
raise InvalidDataError(f"{message}This might be the incorrect world version for this file") from e

def read_contents(self, opened_zipfile: zipfile.ZipFile) -> None:
def read_contents(self, opened_zipfile: zipfile.ZipFile) -> Dict[str, Any]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is something I didn't notice before.
related to #4516 (comment)

Not only is this ambiguous to both mutate and return something, this is also a breaking change.
If this base class returns something in this method, every subclass that overrides it also needs to return the same type.
That could include apworlds that are not in this repo, as well as some in this repo.

If this changes here, it needs to change in every subclass, and we need to think about the deprecation for external apworlds.

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. is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants