From 647d367ac23f3b6bc303ec4ed0dd19c4073b2ec6 Mon Sep 17 00:00:00 2001 From: Thanatos Date: Sat, 14 Oct 2023 13:42:47 +0200 Subject: [PATCH] Another try for multi arena gammas --- .../files/templates/metroid_template.lua | 21 ++++++++++++++++--- tests/test_files/metroid_2b.json | 5 +++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/open_samus_returns_rando/files/templates/metroid_template.lua b/open_samus_returns_rando/files/templates/metroid_template.lua index bf6d592..e6659bd 100644 --- a/open_samus_returns_rando/files/templates/metroid_template.lua +++ b/open_samus_returns_rando/files/templates/metroid_template.lua @@ -12,6 +12,14 @@ function Metroid.DisableSpawnGroup(spawnGroupName) end end +function Metroid.DelayedDelete(spawnGroupName) + Game.DeleteEntity(spawnGroupName) + -- TODO: Generalise the following line + CurrentScenario.OnEnter_Gamma_004_Dead() + -- TODO: Is the name allowed to be random? + Game.SaveGame("checkpoint", "AfterNewAbilityAcquired", "", true) +end + function Metroid.RemoveMetroid(_ARG_0_) local spawnGroupName = CurrentScenario.currentMetroidSpawngroup if spawnGroupName ~= nil then @@ -29,13 +37,14 @@ function Metroid.RemoveMetroid(_ARG_0_) Metroid.DisableSpawnGroup(spawnGroupName) end + if CurrentScenario.isMultiGamma then + Game.AddSF(5.0, "Metroid.DelayedDelete", "s", spawnGroupName) + end + local count = Game.GetItemAmount(Game.GetPlayerName(), "ITEM_METROID_COUNT") + 1 Game.SetItemAmount(Game.GetPlayerName(), "ITEM_METROID_COUNT", count) Game.IncrementMetroidTotalCount(0) - CurrentScenario.currentMetroidSpawngroup = nil - CurrentScenario.isMultiGamma = nil - local scenario = Scenario.CurrentScenarioID if scenario ~= nil and Metroid.Pickups ~= nil and Metroid.Pickups[scenario] ~= nil and @@ -44,9 +53,15 @@ function Metroid.RemoveMetroid(_ARG_0_) Metroid.Pickups[scenario][spawnGroupName].OnPickedUp() end Game.SetInGameMusicState("RELAX") + if not CurrentScenario.isMultiGamma then + -- TODO: Is the name allowed to be random? + Game.SaveGame("checkpoint", "AfterNewAbilityAcquired", "", true) + end else GUI.LaunchMessage("Oops 2", "Metroid.Dummy", "") end + CurrentScenario.currentMetroidSpawngroup = nil + CurrentScenario.isMultiGamma = nil end Metroid.Pickups = TEMPLATE("mapping") diff --git a/tests/test_files/metroid_2b.json b/tests/test_files/metroid_2b.json index f92a47e..73ff80c 100644 --- a/tests/test_files/metroid_2b.json +++ b/tests/test_files/metroid_2b.json @@ -1,7 +1,7 @@ { "starting_location": { - "scenario": "s025_area2b", - "actor": "SpawnGroup019" + "scenario": "s033_area3b", + "actor": "SP_MoheekWall_001" }, "starting_items": { "ITEM_WEAPON_MISSILE_MAX": 50, @@ -12,6 +12,7 @@ "ITEM_WEAPON_WAVE_BEAM": 1, "ITEM_WEAPON_CHARGE_BEAM": 1, "ITEM_WEAPON_SPAZER_BEAM": 1, + "ITEM_VARIA_SUIT": 1, "ITEM_GRAVITY_SUIT": 1, "ITEM_HIGH_JUMP_BOOTS": 1, "ITEM_SPACE_JUMP": 1,