Skip to content

Commit

Permalink
Merge branch 'main' into items-via-lua
Browse files Browse the repository at this point in the history
  • Loading branch information
dyceron committed Sep 22, 2023
2 parents f6ea142 + 9c68bca commit c4624c6
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
14 changes: 14 additions & 0 deletions open_samus_returns_rando/files/custom_savestation.lua
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions open_samus_returns_rando/files/custom_ship.lua
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion open_samus_returns_rando/files/templates/custom_init.lua
Original file line number Diff line number Diff line change
@@ -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")

Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions open_samus_returns_rando/samus_returns_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
4 changes: 3 additions & 1 deletion tests/test_files/starter_preset_patcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down

0 comments on commit c4624c6

Please sign in to comment.