Core: Make manifest accessible as a world attribute (#6122)

This commit is contained in:
Duck
2026-05-09 08:59:05 -06:00
committed by GitHub
parent 06dc1b897c
commit 7a5acfeceb
2 changed files with 13 additions and 1 deletions
+2
View File
@@ -353,6 +353,8 @@ class World(metaclass=AutoWorldRegister):
"""path it was loaded from"""
world_version: ClassVar[Version] = Version(0, 0, 0)
"""Optional world version loaded from archipelago.json"""
manifest: ClassVar[dict[str, Any]] = {}
"""Mapping of the world's archipelago.json manifest. Use game and world_version attrs instead for those values."""
def __init__(self, multiworld: "MultiWorld", player: int):
assert multiworld is not None
+11 -1
View File
@@ -11,7 +11,7 @@ import json
from pathlib import Path
from types import ModuleType
from typing import List, Sequence
from zipfile import BadZipFile
from zipfile import ZipFile, BadZipFile
from NetUtils import DataPackage
from Utils import local_path, user_path, Version, version_tuple, tuplize_version, messagebox
@@ -119,6 +119,7 @@ for world_source in world_sources:
game = manifest.get("game")
if game in AutoWorldRegister.world_types:
AutoWorldRegister.world_types[game].world_version = tuplize_version(manifest.get("world_version", "0.0.0"))
AutoWorldRegister.world_types[game].manifest = manifest
if apworlds:
# encapsulation for namespace / gc purposes
@@ -200,6 +201,15 @@ if apworlds:
# world could fail to load at this point
if apworld.world_version:
AutoWorldRegister.world_types[apworld.game].world_version = apworld.world_version
assert apworld.path
with ZipFile(apworld.path, "r") as zf:
manifest = apworld.read_contents(zf)
# version/compatible_version shouldn't be needed by world, makes it consistent with folder world
manifest.pop("version", None)
manifest.pop("compatible_version", None)
AutoWorldRegister.world_types[apworld.game].manifest = manifest
load_apworlds()
del load_apworlds