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 5 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.

@@ -135,31 +126,61 @@ 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
Contributor

Choose a reason for hiding this comment

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

Nitpicking: Now that the minimal python version is 3.10, using Dict from typing is no longer required. The return type could be replaced with dict[str, Any].

Same for the return type of get_manifest and the various Optional[str] that could be replaced with str | None.

Comment on lines 174 to 176
# minimum version of patch system expected for patching to be successful
"compatible_version": 5,
"version": container_version,
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to keep the compatible_version and version here? They are already added to the manifest in APContainer.

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. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants