-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #414 from randovania/block_shuffle
Support shuffling block types
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 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
19 changes: 19 additions & 0 deletions
19
src/open_samus_returns_rando/misc_patches/block_patches.py
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,19 @@ | ||
from mercury_engine_data_structures.formats import Bmsbk | ||
from open_samus_returns_rando.constants import ALL_SCENARIOS | ||
from open_samus_returns_rando.patcher_editor import PatcherEditor | ||
|
||
|
||
def patch_block_types(editor: PatcherEditor, configuration: dict) -> None: | ||
if len(configuration["block_patches"]) == 0: | ||
return | ||
|
||
for scenario_name in ALL_SCENARIOS: | ||
bmsbk = editor.get_file(f"maps/levels/c10_samus/{scenario_name}/{scenario_name}.bmsbk", Bmsbk) | ||
blocks = bmsbk.raw["block_groups"] | ||
for block in blocks: | ||
block_type = block["types"][0] | ||
for original_type, new_type in configuration["block_patches"].items(): | ||
# Check for the block type and change it to the new type | ||
if original_type == block_type["block_type"]: | ||
block_type["block_type"] = new_type | ||
break |
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