From a3cc416a21297747b412dabe75fc4532cd5c8d68 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 3 Aug 2023 21:57:04 -0400 Subject: Puzzle skips --- Archipelago/effects.gd | 59 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'Archipelago/effects.gd') diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index 80eaa9c..3d6e036 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd @@ -6,6 +6,10 @@ var slowness_remaining = 0 var iceland_remaining = 0 var atbash_activated = false var queued_iceland = 0 +var skip_available = false +var puzzle_focused = false +var solve_mode = false +var puzzle_to_skip = "" var orig_env var orig_walk @@ -90,13 +94,66 @@ func deactivate_atbash_trap(): apclient.evaluateSolvability() +func show_puzzle_skip_message(node_path): + var panel_input = get_tree().get_root().get_node(node_path) + if not panel_input.visible: + return + + var ap_panel = panel_input.get_parent().get_parent().get_parent().get_parent().get_node( + "AP_Panel" + ) + if not ap_panel.solvable: + return + + puzzle_focused = true + puzzle_to_skip = node_path + _evaluate_puzzle_skip() + + +func hide_puzzle_skip_message(): + puzzle_focused = false + _evaluate_puzzle_skip() + + +func enter_solve_mode(): + solve_mode = true + _evaluate_puzzle_skip() + + +func exit_solve_mode(): + solve_mode = false + _evaluate_puzzle_skip() + + +func skip_puzzle(): + if not solve_mode and puzzle_focused: + var apclient = global.get_node("Archipelago") + if apclient.getAvailablePuzzleSkips() > 0: + apclient.usePuzzleSkip() + get_tree().get_root().get_node(puzzle_to_skip).complete() + + +func _evaluate_puzzle_skip(): + if puzzle_focused and not solve_mode: + skip_available = true + + if not effect_running: + _process_effects() + else: + skip_available = false + + func _process_effects(): effect_running = true - while slowness_remaining > 0 or iceland_remaining > 0 or atbash_activated: + while slowness_remaining > 0 or iceland_remaining > 0 or atbash_activated or skip_available: var text = "" if atbash_activated: text += "Atbash Trap lasts until you solve a puzzle" + if skip_available: + var apclient = global.get_node("Archipelago") + if apclient.getAvailablePuzzleSkips() > 0: + text += "Press P to skip puzzle (%d available)" % apclient.getAvailablePuzzleSkips() if slowness_remaining > 0: if not text.empty(): text += "\n" -- cgit 1.4.1