-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support setting initial layer states
- Loading branch information
1 parent
fe37494
commit 7ac6522
Showing
3 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import copy | ||
|
||
from open_prime_rando.patcher_editor import PatcherEditor | ||
import open_prime_rando.echoes.asset_ids.world | ||
|
||
|
||
def expand_schema(base_schema: dict, editor: PatcherEditor) -> dict: | ||
schema = copy.deepcopy(base_schema) | ||
|
||
world_props = schema["properties"]["worlds"]["properties"] = {} | ||
for world, mlvl_id in open_prime_rando.echoes.asset_ids.world.NAME_TO_ID.items(): | ||
world_def = copy.deepcopy(schema["$defs"]["world"]) | ||
world_props[world] = world_def | ||
|
||
mlvl = editor.get_mlvl(mlvl_id) | ||
area_props = {} | ||
world_def["properties"]["areas"] = {"type": "object", "additionalProperties": False, "properties": area_props} | ||
|
||
for area in mlvl.areas: | ||
area_def = copy.deepcopy(schema["$defs"]["area"]) | ||
area_props[area.name] = area_def | ||
|
||
area_def["properties"]["layers"] = { | ||
"type": "object", | ||
"properties": { | ||
layer.name: {"type": "boolean"} | ||
for layer in area.layers | ||
}, | ||
"default": {}, | ||
"additionalProperties": False, | ||
} | ||
|
||
return schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters