diff --git a/open_samus_returns_rando/files/custom_savestation.lua b/open_samus_returns_rando/files/custom_savestation.lua new file mode 100644 index 0000000..d3b780a --- /dev/null +++ b/open_samus_returns_rando/files/custom_savestation.lua @@ -0,0 +1,14 @@ +Game.ImportLibrary("actors/props/savestation/scripts/savestation_original.lc") +function SaveStation.ShowDialogChoice(_ARG_0_, _ARG_1_) + Usable._oUsableObject = _ARG_0_ + GUI.LaunchMessage(_ARG_1_, "Usable.OnDialogAccepted", "SaveStation.OnDialogDeclined") +end +function SaveStation.Dummy() +end +function SaveStation.WarpToStart() + Game.LoadScenario("c10_samus", Init.sStartingScenario, Init.sStartingActor, "samus", 1) +end +function SaveStation.OnDialogDeclined() + Usable._oUsableObject.USABLE:OnDialogDeclined() + GUI.LaunchMessage("Warp to Start?", "SaveStation.WarpToStart", " SaveStation.Dummy()") +end \ No newline at end of file diff --git a/open_samus_returns_rando/files/custom_ship.lua b/open_samus_returns_rando/files/custom_ship.lua new file mode 100644 index 0000000..a15967f --- /dev/null +++ b/open_samus_returns_rando/files/custom_ship.lua @@ -0,0 +1,14 @@ +Game.ImportLibrary("actors/props/samusship/scripts/samusship_original.lc") +function SamusShip.ShowDialogChoice(_ARG_0_, _ARG_1_) + Usable._oUsableObject = _ARG_0_ + GUI.LaunchMessage(_ARG_1_, "Usable.OnDialogAccepted", "SamusShip.OnDialogDeclined") +end +function SamusShip.Dummy() +end +function SamusShip.WarpToStart() + Game.LoadScenario("c10_samus", Init.sStartingScenario, Init.sStartingActor, "samus", 1) +end +function SamusShip.OnDialogDeclined() + Usable._oUsableObject.USABLE:OnDialogDeclined() + GUI.LaunchMessage("Warp to Start?", "SamusShip.WarpToStart", " SamusShip.Dummy()") +end \ No newline at end of file diff --git a/open_samus_returns_rando/files/templates/custom_init.lua b/open_samus_returns_rando/files/templates/custom_init.lua index 0cc36ca..8ad68ec 100644 --- a/open_samus_returns_rando/files/templates/custom_init.lua +++ b/open_samus_returns_rando/files/templates/custom_init.lua @@ -1,7 +1,10 @@ Game.ImportLibrary("system/scripts/init_original.lua") Init.tNewGameInventory = TEMPLATE("new_game_inventory") + Init.bRevealMap = TEMPLATE("reveal_map_on_start") +Init.sStartingScenario = TEMPLATE("starting_scenario") +Init.sStartingActor = TEMPLATE("starting_actor") Init.fEnergyPerTank = TEMPLATE("energy_per_tank") Init.fAeionPerTank = TEMPLATE("aeion_per_tank") @@ -37,7 +40,7 @@ end function Init.InitNewGame(arg1, arg2, arg3, arg4, arg4) Game.LogWarn(0, string.format("Will start Game - %s / %s / %s / %s", tostring(arg1), tostring(arg2), tostring(arg3), tostring(arg4))) - Game.LoadScenario("c10_samus", TEMPLATE("starting_scenario"), TEMPLATE("starting_actor"), "samus", 1) + Game.LoadScenario("c10_samus", Init.sStartingScenario, Init.sStartingActor, "samus", 1) if Init.bRevealMap then Game.AddGUISF(0.0, Game.ScanVisitDiscoverEverything, "", "") end diff --git a/open_samus_returns_rando/samus_returns_patcher.py b/open_samus_returns_rando/samus_returns_patcher.py index b0d8519..e36932c 100644 --- a/open_samus_returns_rando/samus_returns_patcher.py +++ b/open_samus_returns_rando/samus_returns_patcher.py @@ -120,6 +120,8 @@ def patch_extracted(input_path: Path, output_path: Path, configuration: dict): # Add custom lua files lua_util.replace_script(editor, "system/scripts/scenario", "custom_scenario.lua") lua_util.replace_script(editor, "actors/characters/player/scripts/player", "custom_player.lua") + lua_util.replace_script(editor, "actors/props/samusship/scripts/samusship", "custom_ship.lua") + lua_util.replace_script(editor, "actors/props/savestation/scripts/savestation", "custom_savestation.lua") # Custom pickups patch_custom_pickups(editor, configuration["custom_pickups"]) diff --git a/tests/test_files/starter_preset_patcher.json b/tests/test_files/starter_preset_patcher.json index 5004cbd..7ddfa96 100644 --- a/tests/test_files/starter_preset_patcher.json +++ b/tests/test_files/starter_preset_patcher.json @@ -14,7 +14,9 @@ "ITEM_ENERGY_TANKS": 2, "ITEM_AEION_TANKS": 3, "ITEM_WEAPON_BOMB": 1, - "ITEM_WEAPON_WAVE_BEAM": 1 + "ITEM_WEAPON_WAVE_BEAM": 1, + "ITEM_METROID_COUNT": 0, + "ITEM_METROID_TOTAL_COUNT": 40 }, "pickups": [ {