about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-08-03 21:57:04 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-08-03 21:57:04 -0400
commita3cc416a21297747b412dabe75fc4532cd5c8d68 (patch)
tree1eeb76f7e3d7463c133b2ce36aeab59787ee3943
parentcb6db408f38338edb451f323d7e5aa2856854d15 (diff)
downloadlingo-archipelago-a3cc416a21297747b412dabe75fc4532cd5c8d68.tar.gz
lingo-archipelago-a3cc416a21297747b412dabe75fc4532cd5c8d68.tar.bz2
lingo-archipelago-a3cc416a21297747b412dabe75fc4532cd5c8d68.zip
Puzzle skips
-rw-r--r--Archipelago/client.gd12
-rw-r--r--Archipelago/effects.gd59
-rw-r--r--Archipelago/panel.gd3
-rw-r--r--Archipelago/panelInput.gd21
-rw-r--r--Archipelago/player.gd24
-rw-r--r--Archipelago/settings_screen.gd1
6 files changed, 118 insertions, 2 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index e3b2c89..f0a4d2e 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -92,6 +92,7 @@ var _last_new_item = -1
92var _progressive_progress = {} 92var _progressive_progress = {}
93var _has_colors = ["white"] 93var _has_colors = ["white"]
94var _received_indexes = [] 94var _received_indexes = []
95var _puzzle_skips = 0
95 96
96signal could_not_connect 97signal could_not_connect
97signal connect_status 98signal connect_status
@@ -539,6 +540,7 @@ func mapFinishedLoading():
539 _received_indexes.clear() 540 _received_indexes.clear()
540 _progressive_progress.clear() 541 _progressive_progress.clear()
541 _has_colors = ["white"] 542 _has_colors = ["white"]
543 _puzzle_skips = 0
542 emit_signal("evaluate_solvability") 544 emit_signal("evaluate_solvability")
543 545
544 for item in _held_items: 546 for item in _held_items:
@@ -632,6 +634,8 @@ func processItem(item, index, from, flags):
632 effects_node.trigger_iceland_trap() 634 effects_node.trigger_iceland_trap()
633 if item_name == "Atbash Trap": 635 if item_name == "Atbash Trap":
634 effects_node.trigger_atbash_trap() 636 effects_node.trigger_atbash_trap()
637 if item_name == "Puzzle Skip":
638 _puzzle_skips += 1
635 639
636 640
637func doorIsVanilla(door): 641func doorIsVanilla(door):
@@ -646,6 +650,14 @@ func evaluateSolvability():
646 emit_signal("evaluate_solvability") 650 emit_signal("evaluate_solvability")
647 651
648 652
653func getAvailablePuzzleSkips():
654 return _puzzle_skips
655
656
657func usePuzzleSkip():
658 _puzzle_skips -= 1
659
660
649func colorForItemType(flags): 661func colorForItemType(flags):
650 var int_flags = int(flags) 662 var int_flags = int(flags)
651 if int_flags & 1: # progression 663 if int_flags & 1: # progression
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
6var iceland_remaining = 0 6var iceland_remaining = 0
7var atbash_activated = false 7var atbash_activated = false
8var queued_iceland = 0 8var queued_iceland = 0
9var skip_available = false
10var puzzle_focused = false
11var solve_mode = false
12var puzzle_to_skip = ""
9 13
10var orig_env 14var orig_env
11var orig_walk 15var orig_walk
@@ -90,13 +94,66 @@ func deactivate_atbash_trap():
90 apclient.evaluateSolvability() 94 apclient.evaluateSolvability()
91 95
92 96
97func show_puzzle_skip_message(node_path):
98 var panel_input = get_tree().get_root().get_node(node_path)
99 if not panel_input.visible:
100 return
101
102 var ap_panel = panel_input.get_parent().get_parent().get_parent().get_parent().get_node(
103 "AP_Panel"
104 )
105 if not ap_panel.solvable:
106 return
107
108 puzzle_focused = true
109 puzzle_to_skip = node_path
110 _evaluate_puzzle_skip()
111
112
113func hide_puzzle_skip_message():
114 puzzle_focused = false
115 _evaluate_puzzle_skip()
116
117
118func enter_solve_mode():
119 solve_mode = true
120 _evaluate_puzzle_skip()
121
122
123func exit_solve_mode():
124 solve_mode = false
125 _evaluate_puzzle_skip()
126
127
128func skip_puzzle():
129 if not solve_mode and puzzle_focused:
130 var apclient = global.get_node("Archipelago")
131 if apclient.getAvailablePuzzleSkips() > 0:
132 apclient.usePuzzleSkip()
133 get_tree().get_root().get_node(puzzle_to_skip).complete()
134
135
136func _evaluate_puzzle_skip():
137 if puzzle_focused and not solve_mode:
138 skip_available = true
139
140 if not effect_running:
141 _process_effects()
142 else:
143 skip_available = false
144
145
93func _process_effects(): 146func _process_effects():
94 effect_running = true 147 effect_running = true
95 148
96 while slowness_remaining > 0 or iceland_remaining > 0 or atbash_activated: 149 while slowness_remaining > 0 or iceland_remaining > 0 or atbash_activated or skip_available:
97 var text = "" 150 var text = ""
98 if atbash_activated: 151 if atbash_activated:
99 text += "Atbash Trap lasts until you solve a puzzle" 152 text += "Atbash Trap lasts until you solve a puzzle"
153 if skip_available:
154 var apclient = global.get_node("Archipelago")
155 if apclient.getAvailablePuzzleSkips() > 0:
156 text += "Press P to skip puzzle (%d available)" % apclient.getAvailablePuzzleSkips()
100 if slowness_remaining > 0: 157 if slowness_remaining > 0:
101 if not text.empty(): 158 if not text.empty():
102 text += "\n" 159 text += "\n"
diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index da11ddd..da5b572 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd
@@ -4,6 +4,7 @@ var data = {}
4var orig_text = "" 4var orig_text = ""
5var atbash_text = "" 5var atbash_text = ""
6var orig_color = Color(0, 0, 0, 0) 6var orig_color = Color(0, 0, 0, 0)
7var solvable = true
7 8
8const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-" 9const kAtbashPre = "abcdefghijklmnopqrstuvwxyz1234567890+-"
9const kAtbashPost = "zyxwvutsrqponmlkjihgfedcba0987654321-+" 10const kAtbashPost = "zyxwvutsrqponmlkjihgfedcba0987654321-+"
@@ -35,7 +36,7 @@ func evaluate_solvability():
35 var apclient = global.get_node("Archipelago") 36 var apclient = global.get_node("Archipelago")
36 var effects = get_tree().get_root().get_node("Spatial/AP_Effects") 37 var effects = get_tree().get_root().get_node("Spatial/AP_Effects")
37 38
38 var solvable = true 39 solvable = true
39 var missing = [] 40 var missing = []
40 41
41 if apclient._color_shuffle: 42 if apclient._color_shuffle:
diff --git a/Archipelago/panelInput.gd b/Archipelago/panelInput.gd index 48d6324..346dccb 100644 --- a/Archipelago/panelInput.gd +++ b/Archipelago/panelInput.gd
@@ -3,3 +3,24 @@ extends "res://scripts/panelInput.gd"
3 3
4func uncomplete(): 4func uncomplete():
5 global._print("Filtered out panel uncompletion") 5 global._print("Filtered out panel uncompletion")
6
7
8func grab_focus():
9 .grab_focus()
10
11 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
12 effects_node.show_puzzle_skip_message(get_path())
13
14
15func release_focus():
16 .release_focus()
17
18 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
19 effects_node.hide_puzzle_skip_message()
20
21
22func complete():
23 .complete()
24
25 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
26 effects_node.hide_puzzle_skip_message()
diff --git a/Archipelago/player.gd b/Archipelago/player.gd new file mode 100644 index 0000000..87d9d0c --- /dev/null +++ b/Archipelago/player.gd
@@ -0,0 +1,24 @@
1extends "res://scripts/player.gd"
2
3
4func _solving():
5 ._solving()
6
7 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
8 effects_node.enter_solve_mode()
9
10
11func _solvingEnd():
12 ._solvingEnd()
13
14 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
15 effects_node.exit_solve_mode()
16
17
18func _unhandled_input(event):
19 ._unhandled_input(event)
20
21 if event is InputEventKey:
22 if event.pressed and event.scancode == KEY_P:
23 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
24 effects_node.skip_puzzle()
diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index 130506b..3f56962 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd
@@ -31,6 +31,7 @@ func _ready():
31 installScriptExtension("user://maps/Archipelago/panelEnd.gd") 31 installScriptExtension("user://maps/Archipelago/panelEnd.gd")
32 installScriptExtension("user://maps/Archipelago/panelInput.gd") 32 installScriptExtension("user://maps/Archipelago/panelInput.gd")
33 installScriptExtension("user://maps/Archipelago/pause_menu.gd") 33 installScriptExtension("user://maps/Archipelago/pause_menu.gd")
34 installScriptExtension("user://maps/Archipelago/player.gd")
34 installScriptExtension("user://maps/Archipelago/worldTransporter.gd") 35 installScriptExtension("user://maps/Archipelago/worldTransporter.gd")
35 36
36 var apclient = global.get_node("Archipelago") 37 var apclient = global.get_node("Archipelago")