Skip to content

Commit

Permalink
Add hint for Baby location on all DNA textbox
Browse files Browse the repository at this point in the history
  • Loading branch information
dyceron committed Jun 25, 2024
1 parent 80f63ee commit 34fe14d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
37 changes: 26 additions & 11 deletions src/open_samus_returns_rando/files/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/open_samus_returns_rando/lua_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]),
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/open_samus_returns_rando/specific_patches/hint_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 34fe14d

Please sign in to comment.