-
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.
- Loading branch information
Showing
3 changed files
with
47 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
21 changes: 21 additions & 0 deletions
21
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,21 @@ | ||
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] | ||
temp_type: str = "" | ||
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"] and temp_type == "": | ||
# Set the temp_type to the original_type to ensure the block doesnt get changed again | ||
temp_type = original_type | ||
block_type["block_type"] = new_type |
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