Skip to content

Commit c4943e2

Browse files
authored
Merge branch 'main' into precollecteditemclassifications
2 parents e9ea849 + 5a88641 commit c4943e2

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ game contributions:
2020
It is recommended that automated github actions are turned on in your fork to have github run unit tests after
2121
pushing.
2222
You can turn them on here:
23-
![Github actions example](./img/github-actions-example.png)
23+
![Github actions example](/docs/img/github-actions-example.png)
2424

2525
* **When reviewing PRs, please leave a message about what was done.**
2626
We don't have full test coverage, so manual testing can help.

worlds/AutoWorld.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,31 @@ def settings(cls) -> Any: # actual type is defined in World
4747
def __new__(mcs, name: str, bases: Tuple[type, ...], dct: Dict[str, Any]) -> AutoWorldRegister:
4848
if "web" in dct:
4949
assert isinstance(dct["web"], WebWorld), "WebWorld has to be instantiated."
50-
# filter out any events
51-
dct["item_name_to_id"] = {name: id for name, id in dct["item_name_to_id"].items() if id}
52-
dct["location_name_to_id"] = {name: id for name, id in dct["location_name_to_id"].items() if id}
53-
# build reverse lookups
54-
dct["item_id_to_name"] = {code: name for name, code in dct["item_name_to_id"].items()}
55-
dct["location_id_to_name"] = {code: name for name, code in dct["location_name_to_id"].items()}
56-
57-
# build rest
58-
dct["item_names"] = frozenset(dct["item_name_to_id"])
59-
dct["item_name_groups"] = {group_name: frozenset(group_set) for group_name, group_set
60-
in dct.get("item_name_groups", {}).items()}
61-
dct["item_name_groups"]["Everything"] = dct["item_names"]
62-
63-
dct["location_names"] = frozenset(dct["location_name_to_id"])
64-
dct["location_name_groups"] = {group_name: frozenset(group_set) for group_name, group_set
65-
in dct.get("location_name_groups", {}).items()}
66-
dct["location_name_groups"]["Everywhere"] = dct["location_names"]
67-
dct["all_item_and_group_names"] = frozenset(dct["item_names"] | set(dct.get("item_name_groups", {})))
68-
69-
# move away from get_required_client_version function
50+
7051
if "game" in dct:
52+
assert "item_name_to_id" in dct, f"{name}: item_name_to_id is required"
53+
assert "location_name_to_id" in dct, f"{name}: location_name_to_id is required"
54+
55+
# filter out any events
56+
dct["item_name_to_id"] = {name: id for name, id in dct["item_name_to_id"].items() if id}
57+
dct["location_name_to_id"] = {name: id for name, id in dct["location_name_to_id"].items() if id}
58+
# build reverse lookups
59+
dct["item_id_to_name"] = {code: name for name, code in dct["item_name_to_id"].items()}
60+
dct["location_id_to_name"] = {code: name for name, code in dct["location_name_to_id"].items()}
61+
62+
# build rest
63+
dct["item_names"] = frozenset(dct["item_name_to_id"])
64+
dct["item_name_groups"] = {group_name: frozenset(group_set) for group_name, group_set
65+
in dct.get("item_name_groups", {}).items()}
66+
dct["item_name_groups"]["Everything"] = dct["item_names"]
67+
68+
dct["location_names"] = frozenset(dct["location_name_to_id"])
69+
dct["location_name_groups"] = {group_name: frozenset(group_set) for group_name, group_set
70+
in dct.get("location_name_groups", {}).items()}
71+
dct["location_name_groups"]["Everywhere"] = dct["location_names"]
72+
dct["all_item_and_group_names"] = frozenset(dct["item_names"] | set(dct.get("item_name_groups", {})))
73+
74+
# move away from get_required_client_version function
7175
assert "get_required_client_version" not in dct, f"{name}: required_client_version is an attribute now"
7276
# set minimum required_client_version from bases
7377
if "required_client_version" in dct and bases:

0 commit comments

Comments
 (0)