-
Notifications
You must be signed in to change notification settings - Fork 2
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
6 changed files
with
41 additions
and
37 deletions.
There are no files selected for viewing
29 changes: 0 additions & 29 deletions
29
...s_returns_rando/multiworld_integration.py → ...open_samus_returns_rando/exefs_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
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
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
31 changes: 31 additions & 0 deletions
31
src/open_samus_returns_rando/pickups/multiworld_integration.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,31 @@ | ||
|
||
from open_samus_returns_rando.files import files_path | ||
from open_samus_returns_rando.lua_editor import get_parent_for | ||
from open_samus_returns_rando.misc_patches.lua_util import lua_convert | ||
|
||
|
||
def get_lua_for_item(progression: list[list[dict[str, str | int]]], region_name: str) -> str: | ||
generic_pickup = """ | ||
Game.ImportLibrary("actors/items/randomizerpowerup/scripts/randomizerpowerup.lc", false) | ||
MultiworldPickup = MultiworldPickup or {} | ||
function MultiworldPickup.main() | ||
end | ||
function MultiworldPickup.OnPickedUp(progression, actorOrName, regionName) | ||
RandomizerPowerup.OnPickedUp(progression, actorOrName, regionName) | ||
end | ||
""" | ||
|
||
main_item_id = str(progression[0][0]["item_id"]) | ||
parent = get_parent_for(main_item_id) | ||
if parent == "RandomizerPowerup": | ||
parent_content = generic_pickup | ||
else: | ||
parent_lower = parent.lower() | ||
parent_content = files_path().joinpath("pickups", f"{parent_lower}.lua").read_text() | ||
parent_content = parent_content.replace(parent, "MultiworldPickup") | ||
|
||
progression_as_lua = lua_convert(progression, True) | ||
return (f'{parent_content}\nMultiworldPickup.OnPickedUp({progression_as_lua},nil,{region_name})' | ||
.replace("\n", "\\\n").replace("'", "\\'") | ||
) |
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