From 34fe14d86d13e017db4773cff3766e7d432a2193 Mon Sep 17 00:00:00 2001 From: dyceron Date: Mon, 24 Jun 2024 22:55:12 -0400 Subject: [PATCH] Add hint for Baby location on all DNA textbox --- .../files/schema.json | 37 +++++++++++++------ .../files/templates/custom_init.lua | 1 + .../files/templates/randomizerpowerup.lua | 2 +- src/open_samus_returns_rando/lua_editor.py | 7 ++++ .../specific_patches/hint_patches.py | 2 + 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/open_samus_returns_rando/files/schema.json b/src/open_samus_returns_rando/files/schema.json index 54617ed..7a32000 100644 --- a/src/open_samus_returns_rando/files/schema.json +++ b/src/open_samus_returns_rando/files/schema.json @@ -386,19 +386,34 @@ "hints": { "type": "array", "items": { - "type": "object", - "properties": { - "accesspoint_actor": { - "$ref": "#/$defs/actor_reference" - }, - "text": { - "type": "string" + "if": { + "properties": { + "baby_metroid_hint": { + "maxProperties": 1 + } } }, - "required": [ - "accesspoint_actor", - "text" - ] + "then": { + "properties": { + "text": { + "type": "string" + } + } + }, + "else": { + "properties": { + "accesspoint_actor": { + "$ref": "#/$defs/actor_reference" + }, + "text": { + "type": "string" + } + }, + "required": [ + "accesspoint_actor", + "text" + ] + } }, "default": [] }, 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 f1547dd..baa12e5 100644 --- a/src/open_samus_returns_rando/files/templates/custom_init.lua +++ b/src/open_samus_returns_rando/files/templates/custom_init.lua @@ -32,6 +32,7 @@ Init.sLayoutUUID = TEMPLATE("layout_uuid") Init.sThisRandoIdentifier = TEMPLATE("configuration_identifier") .. Init.sLayoutUUID Init.tBoxesSeen = 0 Init.bEnableRoomIds = TEMPLATE("enable_room_ids") +Init.sBabyMetroidHint = TEMPLATE("baby_metroid_hint") 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 ceb8787..e504cb3 100644 --- a/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua +++ b/src/open_samus_returns_rando/files/templates/randomizerpowerup.lua @@ -103,7 +103,7 @@ function RandomizerPowerup.ObjectiveComplete() GUI.LaunchMessage("All Metroid DNA has been collected!\nThe path to Proteus Ridley has been opened in Surface West!", "RandomizerPowerup.Dummy", "") elseif baby == 0 then - GUI.LaunchMessage("All Metroid DNA has been collected!\nContinue searching for the Baby Metroid!", + GUI.LaunchMessage("All Metroid DNA has been collected!\n" .. Init.sBabyMetroidHint, "RandomizerPowerup.Dummy", "") end end diff --git a/src/open_samus_returns_rando/lua_editor.py b/src/open_samus_returns_rando/lua_editor.py index db4942d..5b536d8 100644 --- a/src/open_samus_returns_rando/lua_editor.py +++ b/src/open_samus_returns_rando/lua_editor.py @@ -255,6 +255,12 @@ def chunks(array: list[str], n: int) -> Iterable[list[str]]: if "layout_uuid" in configuration: layout_uuid = lua_util.wrap_string(configuration["layout_uuid"]) + + baby_metroid_hint = lua_util.wrap_string("Continue searching for the Baby Metroid.") + for hint in configuration["hints"]: + if "baby_metroid_hint" in hint: + baby_metroid_hint = lua_util.wrap_string(hint["baby_metroid_hint"]["text"]) + replacement = { "new_game_inventory": final_inventory, "starting_scenario": lua_util.wrap_string(starting_location["scenario"]), @@ -268,6 +274,7 @@ def chunks(array: list[str], n: int) -> Iterable[list[str]]: "enable_room_ids": False if cosmetic_options["enable_room_name_display"] == "NEVER" else True, "layout_uuid": layout_uuid, "enable_remote_lua": enable_remote_lua, + "baby_metroid_hint": baby_metroid_hint } return lua_util.replace_lua_template("custom_init.lua", replacement) diff --git a/src/open_samus_returns_rando/specific_patches/hint_patches.py b/src/open_samus_returns_rando/specific_patches/hint_patches.py index 18542cc..93ecca0 100644 --- a/src/open_samus_returns_rando/specific_patches/hint_patches.py +++ b/src/open_samus_returns_rando/specific_patches/hint_patches.py @@ -3,4 +3,6 @@ def patch_hints(lua_scripts: LuaEditor, hints: list) -> None: for hint in hints: + if "baby_metroid_hint" in hint: + continue lua_scripts.add_hint(hint)