From c26c058f61e1f7d0c095825c083e76c295cf04aa Mon Sep 17 00:00:00 2001 From: dyceron Date: Tue, 20 Feb 2024 19:28:24 -0500 Subject: [PATCH 1/3] Only enable Missile Reserve Tank if Missile Launcher is in inventory --- .../files/pickups/randomizermissilelauncher.lua | 3 +++ .../files/pickups/randomizerreservetankm.lua | 7 +++---- .../files/templates/custom_init.lua | 9 +++++++-- .../files/templates/randomizerpowerup.lua | 7 +++++++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/open_samus_returns_rando/files/pickups/randomizermissilelauncher.lua b/src/open_samus_returns_rando/files/pickups/randomizermissilelauncher.lua index 6bc1f31d..98b25382 100644 --- a/src/open_samus_returns_rando/files/pickups/randomizermissilelauncher.lua +++ b/src/open_samus_returns_rando/files/pickups/randomizermissilelauncher.lua @@ -16,4 +16,7 @@ function RandomizerMissileLauncher.OnPickedUp(progression) RandomizerPowerup.OnPickedUp(progression) RandomizerPowerup.SetItemAmount("ITEM_MISSILE_TANKS", 0) RandomizerPowerup.IncreaseMissileCheckValue() + if RandomizerPowerup.GetItemAmount("ITEM_RESERVE_TANK_MISSILE") > 0 then + RandomizerPowerup.EnableMissileReserveTank() + end end diff --git a/src/open_samus_returns_rando/files/pickups/randomizerreservetankm.lua b/src/open_samus_returns_rando/files/pickups/randomizerreservetankm.lua index f050647c..cc84a1dc 100644 --- a/src/open_samus_returns_rando/files/pickups/randomizerreservetankm.lua +++ b/src/open_samus_returns_rando/files/pickups/randomizerreservetankm.lua @@ -5,8 +5,7 @@ end function RandomizerReserveTankM.OnPickedUp(progression) RandomizerPowerup.OnPickedUp(progression) - Blackboard.SetProp("GAME", "ITEM_RESERVE_TANK_MISSILE_ACTIVE", "b", true) - Blackboard.SetProp("GAME", "ITEM_RESERVE_TANK_MISSILE_FULL", "b", true) - Game.AddSF(0.0, "Game.HUDIdleScreenGo", "") - Game.AddSF(0.5, "Game.HUDIdleScreenLeave", "") + if RandomizerPowerup.GetItemAmount("ITEM_WEAPON_MISSILE_LAUNCHER") > 0 then + RandomizerPowerup.EnableMissileReserveTank() + end end \ No newline at end of file diff --git a/src/open_samus_returns_rando/files/templates/custom_init.lua b/src/open_samus_returns_rando/files/templates/custom_init.lua index 1acae8ca..b116f890 100644 --- a/src/open_samus_returns_rando/files/templates/custom_init.lua +++ b/src/open_samus_returns_rando/files/templates/custom_init.lua @@ -24,8 +24,13 @@ function Init.InitGameBlackboard() Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_ADN", "f", current_amount + 1) end if string.sub(_FORV_3_, 1, 17) == "ITEM_RESERVE_TANK" then - Blackboard.SetProp("GAME", _FORV_3_ .. "_ACTIVE", "b", true) - Blackboard.SetProp("GAME", _FORV_3_ .. "_FULL", "b", true) + if _FORV_3_ == "ITEM_RESERVE_TANK_MISSILE" and Blackboard.GetProp("PLAYER_INVENTORY", "ITEM_WEAPON_MISSILE_LAUNCHER") then + Blackboard.SetProp("GAME", "ITEM_RESERVE_TANK_MISSILE_ACTIVE", "b", true) + Blackboard.SetProp("GAME", "ITEM_RESERVE_TANK_MISSILE_FULL", "b", true) + elseif _FORV_3_ ~= "ITEM_RESERVE_TANK_MISSILE" then + Blackboard.SetProp("GAME", _FORV_3_ .. "_ACTIVE", "b", true) + Blackboard.SetProp("GAME", _FORV_3_ .. "_FULL", "b", true) + end end end Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_METROID_COUNT", "f", 0) diff --git a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua index 4e3fcc0e..fe7e0642 100644 --- a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua +++ b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua @@ -149,3 +149,10 @@ function RandomizerPowerup.IncreaseMissileCheckValue() RandomizerPowerup.SetItemAmount("ITEM_MISSILE_CHECK", RandomizerPowerup.GetItemAmount("ITEM_WEAPON_MISSILE_MAX")) end end + +function RandomizerPowerup.EnableMissileReserveTank() + Blackboard.SetProp("GAME", "ITEM_RESERVE_TANK_MISSILE_ACTIVE", "b", true) + Blackboard.SetProp("GAME", "ITEM_RESERVE_TANK_MISSILE_FULL", "b", true) + Game.AddSF(0.0, "Game.HUDIdleScreenGo", "") + Game.AddSF(0.5, "Game.HUDIdleScreenLeave", "") +end From 05d195dd0a56500ab5e9b913e6ef2bd693f29f0f Mon Sep 17 00:00:00 2001 From: dyceron <38679103+dyceron@users.noreply.github.com> Date: Wed, 21 Feb 2024 06:49:27 -0500 Subject: [PATCH 2/3] Cleanup conditional --- .../files/templates/custom_init.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/open_samus_returns_rando/files/templates/custom_init.lua b/src/open_samus_returns_rando/files/templates/custom_init.lua index b116f890..df6f15ab 100644 --- a/src/open_samus_returns_rando/files/templates/custom_init.lua +++ b/src/open_samus_returns_rando/files/templates/custom_init.lua @@ -24,10 +24,7 @@ function Init.InitGameBlackboard() Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_ADN", "f", current_amount + 1) end if string.sub(_FORV_3_, 1, 17) == "ITEM_RESERVE_TANK" then - if _FORV_3_ == "ITEM_RESERVE_TANK_MISSILE" and Blackboard.GetProp("PLAYER_INVENTORY", "ITEM_WEAPON_MISSILE_LAUNCHER") then - Blackboard.SetProp("GAME", "ITEM_RESERVE_TANK_MISSILE_ACTIVE", "b", true) - Blackboard.SetProp("GAME", "ITEM_RESERVE_TANK_MISSILE_FULL", "b", true) - elseif _FORV_3_ ~= "ITEM_RESERVE_TANK_MISSILE" then + if (_FORV_3_ == "ITEM_RESERVE_TANK_MISSILE" and Blackboard.GetProp("PLAYER_INVENTORY", "ITEM_WEAPON_MISSILE_LAUNCHER")) or _FORV_3_ ~= "ITEM_RESERVE_TANK_MISSILE" then Blackboard.SetProp("GAME", _FORV_3_ .. "_ACTIVE", "b", true) Blackboard.SetProp("GAME", _FORV_3_ .. "_FULL", "b", true) end @@ -98,4 +95,4 @@ Game.SetForceSkipCutscenes(true) -- "s100_area10", -- "s110_surfaceb", -- } --- NextScenario = 1 \ No newline at end of file +-- NextScenario = 1 From 0c856bdfc1034fdc295dcbf6fe655029fe5fa45f Mon Sep 17 00:00:00 2001 From: dyceron <38679103+dyceron@users.noreply.github.com> Date: Wed, 21 Feb 2024 07:09:55 -0500 Subject: [PATCH 3/3] Fix conditional --- src/open_samus_returns_rando/files/templates/custom_init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/open_samus_returns_rando/files/templates/custom_init.lua b/src/open_samus_returns_rando/files/templates/custom_init.lua index df6f15ab..c2f9f045 100644 --- a/src/open_samus_returns_rando/files/templates/custom_init.lua +++ b/src/open_samus_returns_rando/files/templates/custom_init.lua @@ -24,7 +24,7 @@ function Init.InitGameBlackboard() Blackboard.SetProp("PLAYER_INVENTORY", "ITEM_ADN", "f", current_amount + 1) end if string.sub(_FORV_3_, 1, 17) == "ITEM_RESERVE_TANK" then - if (_FORV_3_ == "ITEM_RESERVE_TANK_MISSILE" and Blackboard.GetProp("PLAYER_INVENTORY", "ITEM_WEAPON_MISSILE_LAUNCHER")) or _FORV_3_ ~= "ITEM_RESERVE_TANK_MISSILE" then + if _FORV_3_ ~= "ITEM_RESERVE_TANK_MISSILE" or Blackboard.GetProp("PLAYER_INVENTORY", "ITEM_WEAPON_MISSILE_LAUNCHER") then Blackboard.SetProp("GAME", _FORV_3_ .. "_ACTIVE", "b", true) Blackboard.SetProp("GAME", _FORV_3_ .. "_FULL", "b", true) end