From 74af694f1076c8f9eaa4bbdefe9e9ba83fb15fc4 Mon Sep 17 00:00:00 2001 From: dyceron Date: Sun, 28 Jul 2024 16:31:52 -0400 Subject: [PATCH] Allow for placing more than 39 dna via config --- src/open_samus_returns_rando/files/schema.json | 5 +++++ src/open_samus_returns_rando/files/templates/custom_init.lua | 1 + .../files/templates/randomizerpowerup.lua | 2 +- src/open_samus_returns_rando/lua_editor.py | 3 ++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/open_samus_returns_rando/files/schema.json b/src/open_samus_returns_rando/files/schema.json index db76e61..ac02e9f 100644 --- a/src/open_samus_returns_rando/files/schema.json +++ b/src/open_samus_returns_rando/files/schema.json @@ -261,6 +261,11 @@ "minimum": 0, "default": 39 }, + "extra_dna": { + "description": "Extra Metroid DNA to place in the game.", + "type": "integer", + "default": 0 + }, "reveal_map_on_start": { "type": "boolean", "default": false, 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 cfe4067..ddfb5b0 100644 --- a/src/open_samus_returns_rando/files/templates/custom_init.lua +++ b/src/open_samus_returns_rando/files/templates/custom_init.lua @@ -35,6 +35,7 @@ Init.bEnableRoomIds = TEMPLATE("enable_room_ids") Init.sBabyMetroidHint = TEMPLATE("baby_metroid_hint") Init.bTanksRefillAmmo = TEMPLATE("tanks_refill_ammo") Init.iRequiredDNA = TEMPLATE("required_dna") +Init.iExtraDNA = TEMPLATE("extra_dna") local orig_log = Game.LogWarn if TEMPLATE("enable_remote_lua") then diff --git a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua index eecd9e5..c014887 100644 --- a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua +++ b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua @@ -195,7 +195,7 @@ function RandomizerPowerup.IncreaseAmmo(resource) end function RandomizerPowerup.ObjectiveComplete() - if RandomizerPowerup.GetItemAmount("ITEM_ADN") == 39 then + if RandomizerPowerup.GetItemAmount("ITEM_ADN") == (39 + Init.iExtraDNA) then Blackboard.SetProp("GAME", "OBJECTIVE_COMPLETE", "b", true) Game.HUDIdleScreenLeave() local baby = RandomizerPowerup.GetItemAmount("ITEM_BABY_HATCHLING") diff --git a/src/open_samus_returns_rando/lua_editor.py b/src/open_samus_returns_rando/lua_editor.py index cbfa684..b432f81 100644 --- a/src/open_samus_returns_rando/lua_editor.py +++ b/src/open_samus_returns_rando/lua_editor.py @@ -276,7 +276,8 @@ def chunks(array: list[str], n: int) -> Iterable[list[str]]: "enable_remote_lua": enable_remote_lua, "baby_metroid_hint": baby_metroid_hint, "tanks_refill_ammo": game_patches["tanks_refill_ammo"], - "required_dna": configuration["required_dna"] + "required_dna": configuration["required_dna"], + "extra_dna": configuration["extra_dna"] } return lua_util.replace_lua_template("custom_init.lua", replacement)