Skip to content

Commit

Permalink
Another try for multi arena gammas
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanatosGit committed Oct 14, 2023
1 parent b2a3812 commit 647d367
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
21 changes: 18 additions & 3 deletions open_samus_returns_rando/files/templates/metroid_template.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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")
5 changes: 3 additions & 2 deletions tests/test_files/metroid_2b.json
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 647d367

Please sign in to comment.