about summary refs log tree commit diff stats
path: root/Archipelago
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-03-17 12:27:50 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-03-17 12:27:50 -0400
commit09ec745987d0b156c4628b12eb409003572eef13 (patch)
treec8b71ff3757ed296b6a2aff128d9d7ffbcbb36ff /Archipelago
parent2b286074992e3ae76b48c4c033b2a81fc8913377 (diff)
parent38004bc2cd3d27b40ab9942488ed0257751337e0 (diff)
downloadlingo-archipelago-09ec745987d0b156c4628b12eb409003572eef13.tar.gz
lingo-archipelago-09ec745987d0b156c4628b12eb409003572eef13.tar.bz2
lingo-archipelago-09ec745987d0b156c4628b12eb409003572eef13.zip
Merge branch 'future' into sunwarps
Diffstat (limited to 'Archipelago')
-rw-r--r--Archipelago/client.gd32
-rw-r--r--Archipelago/effects.gd173
-rw-r--r--Archipelago/load.gd41
-rw-r--r--Archipelago/panel.gd2
-rw-r--r--Archipelago/panelEnd.gd2
-rw-r--r--Archipelago/panelLevelSwitch.gd2
6 files changed, 186 insertions, 66 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index b3668d7..4431fa0 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -16,8 +16,8 @@ var ap_pass = ""
16var confusify_world = false 16var confusify_world = false
17var enable_multiplayer = false 17var enable_multiplayer = false
18 18
19const my_version = "1.1.0" 19const my_version = "2.0.0-beta2"
20const ap_version = {"major": 0, "minor": 4, "build": 4, "class": "Version"} 20const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"}
21const color_items = [ 21const color_items = [
22 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow" 22 "White", "Black", "Red", "Blue", "Green", "Brown", "Gray", "Orange", "Purple", "Yellow"
23] 23]
@@ -148,6 +148,9 @@ var _progressive_progress = {}
148var _has_colors = ["white"] 148var _has_colors = ["white"]
149var _received_indexes = [] 149var _received_indexes = []
150var _puzzle_skips = 0 150var _puzzle_skips = 0
151var _cached_slowness = 0
152var _cached_iceland = 0
153var _cached_atbash = 0
151 154
152signal could_not_connect 155signal could_not_connect
153signal connect_status 156signal connect_status
@@ -346,6 +349,21 @@ func _on_data():
346 if localdata.size() > 1: 349 if localdata.size() > 1:
347 _puzzle_skips = localdata[1] 350 _puzzle_skips = localdata[1]
348 351
352 if localdata.size() > 2:
353 _cached_slowness = localdata[2]
354 else:
355 _cached_slowness = 0
356
357 if localdata.size() > 3:
358 _cached_iceland = localdata[3]
359 else:
360 _cached_iceland = 0
361
362 if localdata.size() > 4:
363 _cached_atbash = localdata[4]
364 else:
365 _cached_atbash = 0
366
349 requestSync() 367 requestSync()
350 368
351 emit_signal("client_connected") 369 emit_signal("client_connected")
@@ -498,7 +516,15 @@ func saveLocaldata():
498 var file = File.new() 516 var file = File.new()
499 file.open(_localdata_file, File.WRITE) 517 file.open(_localdata_file, File.WRITE)
500 518
501 var data = [_last_new_item, _puzzle_skips] 519 var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects")
520
521 var data = [
522 _last_new_item,
523 _puzzle_skips,
524 effects_node.slowness_remaining,
525 effects_node.iceland_remaining,
526 effects_node.atbash_remaining
527 ]
502 file.store_var(data, true) 528 file.store_var(data, true)
503 file.close() 529 file.close()
504 530
diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index ae134bc..1e2e311 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd
@@ -4,16 +4,19 @@ var activated = false
4var effect_running = false 4var effect_running = false
5var slowness_remaining = 0 5var slowness_remaining = 0
6var iceland_remaining = 0 6var iceland_remaining = 0
7var atbash_activated = false 7var atbash_remaining = 0
8var queued_iceland = 0 8var queued_iceland = 0
9var skip_available = false 9var skip_available = false
10var puzzle_focused = false 10var puzzle_focused = false
11var solve_mode = false 11var solve_mode = false
12var not_behind_wall = false
12var puzzle_to_skip = "" 13var puzzle_to_skip = ""
14var text_dirty = true
13 15
14var orig_env 16var orig_env
15var orig_walk 17var orig_walk
16var orig_run 18var orig_run
19var wallcast
17 20
18 21
19func _ready(): 22func _ready():
@@ -21,6 +24,8 @@ func _ready():
21 orig_walk = get_tree().get_root().get_node("Spatial/player").walk_speed 24 orig_walk = get_tree().get_root().get_node("Spatial/player").walk_speed
22 orig_run = get_tree().get_root().get_node("Spatial/player").run_speed 25 orig_run = get_tree().get_root().get_node("Spatial/player").run_speed
23 26
27 wallcast = get_tree().get_root().get_node("Spatial/player/pivot/camera/wallcast")
28
24 var label = Label.new() 29 var label = Label.new()
25 label.set_name("label") 30 label.set_name("label")
26 label.margin_right = 1920.0 - 20.0 31 label.margin_right = 1920.0 - 20.0
@@ -37,31 +42,46 @@ func _ready():
37 42
38 add_child(label) 43 add_child(label)
39 44
45 var slowness_timer = Timer.new()
46 slowness_timer.name = "SlownessTimer"
47 slowness_timer.wait_time = 1.0
48 add_child(slowness_timer)
49 slowness_timer.connect("timeout", self, "_tick_slowness")
50
51 var iceland_timer = Timer.new()
52 iceland_timer.name = "IcelandTimer"
53 iceland_timer.wait_time = 1.0
54 add_child(iceland_timer)
55 iceland_timer.connect("timeout", self, "_tick_iceland")
56
40 57
41func activate(): 58func activate():
42 activated = true 59 activated = true
43 60
44 for _i in range(0, queued_iceland): 61 if queued_iceland > 0:
45 trigger_iceland_trap() 62 trigger_iceland_trap(queued_iceland)
46 63
47 queued_iceland = 0 64 queued_iceland = 0
48 65
49 66
50func trigger_slowness_trap(): 67func trigger_slowness_trap(length = 30):
51 if slowness_remaining == 0: 68 if slowness_remaining == 0:
52 var player = get_tree().get_root().get_node("Spatial/player") 69 var player = get_tree().get_root().get_node("Spatial/player")
53 player.walk_speed = orig_walk / 2.0 70 player.walk_speed = orig_walk / 2.0
54 player.run_speed = orig_run / 2.0 71 player.run_speed = orig_run / 2.0
55 72
56 slowness_remaining += 30 73 $SlownessTimer.start()
57 74
58 if not effect_running: 75 slowness_remaining += length
59 _process_effects() 76 text_dirty = true
60 77
78 var apclient = global.get_node("Archipelago")
79 apclient.saveLocaldata()
61 80
62func trigger_iceland_trap(): 81
82func trigger_iceland_trap(length = 60):
63 if not activated: 83 if not activated:
64 queued_iceland += 1 84 queued_iceland += length
65 return 85 return
66 86
67 if iceland_remaining == 0: 87 if iceland_remaining == 0:
@@ -69,32 +89,47 @@ func trigger_iceland_trap():
69 load("res://environments/level_iceland.tres") 89 load("res://environments/level_iceland.tres")
70 ) 90 )
71 91
72 iceland_remaining += 60 92 $IcelandTimer.start()
93
94 iceland_remaining += length
95 text_dirty = true
73 96
74 if not effect_running: 97 var apclient = global.get_node("Archipelago")
75 _process_effects() 98 apclient.saveLocaldata()
76 99
77 100
78func trigger_atbash_trap(): 101func trigger_atbash_trap():
79 if not atbash_activated: 102 var newly_atbash = (atbash_remaining == 0)
80 atbash_activated = true 103 atbash_remaining += 1
81 104
105 if newly_atbash:
82 var apclient = global.get_node("Archipelago") 106 var apclient = global.get_node("Archipelago")
83 apclient.evaluateSolvability() 107 apclient.evaluateSolvability()
84 108
85 if not effect_running: 109 text_dirty = true
86 _process_effects() 110
111 var apclient = global.get_node("Archipelago")
112 apclient.saveLocaldata()
87 113
88 114
89func deactivate_atbash_trap(): 115func deactivate_atbash_trap():
90 if atbash_activated: 116 if atbash_remaining > 0:
91 atbash_activated = false 117 atbash_remaining -= 1
92 118
93 var apclient = global.get_node("Archipelago") 119 if atbash_remaining == 0:
94 apclient.evaluateSolvability() 120 var apclient = global.get_node("Archipelago")
121 apclient.evaluateSolvability()
122
123 text_dirty = true
124
125 var apclient = global.get_node("Archipelago")
126 apclient.saveLocaldata()
95 127
96 128
97func show_puzzle_skip_message(node_path): 129func show_puzzle_skip_message(node_path):
130 if puzzle_focused and node_path != puzzle_to_skip:
131 hide_puzzle_skip_message()
132
98 var panel_input = get_tree().get_root().get_node(node_path) 133 var panel_input = get_tree().get_root().get_node(node_path)
99 if not panel_input.visible: 134 if not panel_input.visible:
100 return 135 return
@@ -106,12 +141,18 @@ func show_puzzle_skip_message(node_path):
106 return 141 return
107 142
108 puzzle_focused = true 143 puzzle_focused = true
144 wallcast.enabled = true
145 not_behind_wall = false
146 text_dirty = true
109 puzzle_to_skip = node_path 147 puzzle_to_skip = node_path
110 _evaluate_puzzle_skip() 148 _evaluate_puzzle_skip()
111 149
112 150
113func hide_puzzle_skip_message(): 151func hide_puzzle_skip_message():
114 puzzle_focused = false 152 puzzle_focused = false
153 wallcast.enabled = false
154 not_behind_wall = false
155 text_dirty = true
115 _evaluate_puzzle_skip() 156 _evaluate_puzzle_skip()
116 157
117 158
@@ -136,26 +177,64 @@ func skip_puzzle():
136func _evaluate_puzzle_skip(): 177func _evaluate_puzzle_skip():
137 if puzzle_focused and not solve_mode: 178 if puzzle_focused and not solve_mode:
138 skip_available = true 179 skip_available = true
139
140 if not effect_running:
141 _process_effects()
142 else: 180 else:
143 skip_available = false 181 skip_available = false
182 text_dirty = true
183
184
185func _tick_slowness():
186 slowness_remaining -= 1
187 text_dirty = true
188
189 if slowness_remaining == 0:
190 var player = get_tree().get_root().get_node("Spatial/player")
191 player.walk_speed = orig_walk
192 player.run_speed = orig_run
193
194 $SlownessTimer.stop()
195
196 if slowness_remaining % 5 == 0:
197 var apclient = global.get_node("Archipelago")
198 apclient.saveLocaldata()
199
200
201func _tick_iceland():
202 iceland_remaining -= 1
203 text_dirty = true
204
205 if iceland_remaining == 0:
206 get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment(
207 orig_env
208 )
209
210 $IcelandTimer.stop()
211
212 if iceland_remaining % 5 == 0:
213 var apclient = global.get_node("Archipelago")
214 apclient.saveLocaldata()
215
144 216
217func _process(_delta):
218 if puzzle_focused:
219 var should_nbw = false
220 if wallcast.is_colliding():
221 var player = get_tree().get_root().get_node("Spatial/player")
222 var puzzlecast = player.get_node("pivot/camera/RayCast_sight")
223 var distance = puzzlecast.get_collision_point().distance_to(wallcast.get_collision_point())
224 should_nbw = (distance < 0.05)
225
226 if should_nbw != not_behind_wall:
227 not_behind_wall = should_nbw
228 text_dirty = true
145 229
146func _process_effects(): 230 if text_dirty:
147 effect_running = true 231 text_dirty = false
148 232
149 while slowness_remaining > 0 or iceland_remaining > 0 or atbash_activated or skip_available:
150 var text = "" 233 var text = ""
151 if atbash_activated: 234 if atbash_remaining == 1:
152 text += "Atbash Trap lasts until you solve a puzzle" 235 text += "Atbash Trap lasts until you solve a puzzle"
153 if skip_available: 236 if atbash_remaining > 1:
154 var apclient = global.get_node("Archipelago") 237 text += ("Atbash Trap lasts until you solve %d puzzles" % atbash_remaining)
155 if apclient.getAvailablePuzzleSkips() > 0:
156 if not text.empty():
157 text += "\n"
158 text += "Press P to skip puzzle (%d available)" % apclient.getAvailablePuzzleSkips()
159 if slowness_remaining > 0: 238 if slowness_remaining > 0:
160 if not text.empty(): 239 if not text.empty():
161 text += "\n" 240 text += "\n"
@@ -164,26 +243,10 @@ func _process_effects():
164 if not text.empty(): 243 if not text.empty():
165 text += "\n" 244 text += "\n"
166 text += "Iceland: %d seconds" % iceland_remaining 245 text += "Iceland: %d seconds" % iceland_remaining
246 if skip_available and not_behind_wall:
247 var apclient = global.get_node("Archipelago")
248 if apclient.getAvailablePuzzleSkips() > 0:
249 if not text.empty():
250 text += "\n"
251 text += "Press P to skip puzzle (%d available)" % apclient.getAvailablePuzzleSkips()
167 self.get_node("label").text = text 252 self.get_node("label").text = text
168
169 yield(get_tree().create_timer(1.0), "timeout")
170
171 if !get_tree().paused:
172 if slowness_remaining > 0:
173 slowness_remaining -= 1
174
175 if slowness_remaining == 0:
176 var player = get_tree().get_root().get_node("Spatial/player")
177 player.walk_speed = orig_walk
178 player.run_speed = orig_run
179
180 if iceland_remaining > 0:
181 iceland_remaining -= 1
182
183 if iceland_remaining == 0:
184 get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment(
185 orig_env
186 )
187
188 self.get_node("label").text = ""
189 effect_running = false
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 0750247..673c762 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd
@@ -14,7 +14,8 @@ const EXCLUDED_PAINTINGS = [
14 "scenery_3.tscn", 14 "scenery_3.tscn",
15 "scenery_4.tscn", 15 "scenery_4.tscn",
16 "scenery_5.tscn", 16 "scenery_5.tscn",
17 "pilgrim.tscn" 17 "pilgrim.tscn",
18 "so_pearl_bk.tscn"
18] 19]
19 20
20 21
@@ -24,6 +25,15 @@ func _load():
24 var apclient = global.get_node("Archipelago") 25 var apclient = global.get_node("Archipelago")
25 var panels_parent = self.get_node("Panels") 26 var panels_parent = self.get_node("Panels")
26 27
28 # Add a wall-blocked raycast to the player.
29 var wallcast = RayCast.new()
30 wallcast.name = "wallcast"
31 wallcast.cast_to = Vector3(0, 0, -15)
32 wallcast.set_collision_mask_bit(1, true)
33 wallcast.set_collision_mask_bit(3, true)
34 wallcast.collide_with_areas = true
35 $player/pivot/camera.add_child(wallcast)
36
27 # Override the YOU panel with the AP slot name. 37 # Override the YOU panel with the AP slot name.
28 if self.get_node_or_null("Panels/Color Arrow Room/Panel_you") != null: 38 if self.get_node_or_null("Panels/Color Arrow Room/Panel_you") != null:
29 self.get_node("Panels/Color Arrow Room/Panel_you").answer = apclient.ap_user 39 self.get_node("Panels/Color Arrow Room/Panel_you").answer = apclient.ap_user
@@ -198,6 +208,10 @@ func _load():
198 set_gridmap_tile(-88.5, 4.5, -41.5, "MeshInstance8") 208 set_gridmap_tile(-88.5, 4.5, -41.5, "MeshInstance8")
199 set_gridmap_tile(-89.5, 4.5, -41.5, "MeshInstance4") 209 set_gridmap_tile(-89.5, 4.5, -41.5, "MeshInstance4")
200 210
211 # Remove black block from THE RED.
212 clear_gridmap_tile(68.5, 6.5, 76.5)
213 get_node("Decorations/PanelSign/sign19").queue_free()
214
201 if apclient.confusify_world: 215 if apclient.confusify_world:
202 # Remove welcome back / color hallway / sunwarp indicators. 216 # Remove welcome back / color hallway / sunwarp indicators.
203 get_node("Decorations/Signs/Welcome Back Signs").queue_free() 217 get_node("Decorations/Signs/Welcome Back Signs").queue_free()
@@ -245,12 +259,12 @@ func _load():
245 259
246 if apclient._panel_shuffle != apclient.kNO_PANEL_SHUFFLE: 260 if apclient._panel_shuffle != apclient.kNO_PANEL_SHUFFLE:
247 # Make The Wondrous's FIRE solely midred. 261 # Make The Wondrous's FIRE solely midred.
248 set_gridmap_tile(-76.5, 1.5, -73.5, "MeshInstance18") 262 clear_gridmap_tile(-76.5, 1.5, -73.5)
249 263
250 # Reduce double/triple length puzzles in Knight/Night. 264 # Reduce double/triple length puzzles in Knight/Night.
251 set_gridmap_tile(24.5, 1.5, 11.5, "MeshInstance18") 265 clear_gridmap_tile(24.5, 1.5, 11.5)
252 set_gridmap_tile(25.5, 1.5, 11.5, "MeshInstance18") 266 clear_gridmap_tile(25.5, 1.5, 11.5)
253 set_gridmap_tile(47.5, 1.5, 11.5, "MeshInstance18") 267 clear_gridmap_tile(47.5, 1.5, 11.5)
254 268
255 if apclient._panel_shuffle == apclient.kREARRANGE_PANELS: 269 if apclient._panel_shuffle == apclient.kREARRANGE_PANELS:
256 # Do the actual shuffling. 270 # Do the actual shuffling.
@@ -638,6 +652,15 @@ func _load():
638 global._print("Hooked Load End") 652 global._print("Hooked Load End")
639 ._load() 653 ._load()
640 654
655 # Activate any cached traps.
656 if apclient._cached_slowness > 0:
657 effects.trigger_slowness_trap(apclient._cached_slowness)
658 if apclient._cached_iceland > 0:
659 effects.trigger_iceland_trap(apclient._cached_iceland)
660 if apclient._cached_atbash > 0:
661 for _i in range(0, apclient._cached_atbash):
662 effects.trigger_atbash_trap()
663
641 # Process any items received while the map was loading, and send the checks 664 # Process any items received while the map was loading, and send the checks
642 # from the save load. 665 # from the save load.
643 apclient.mapFinishedLoading() 666 apclient.mapFinishedLoading()
@@ -708,6 +731,14 @@ func set_gridmap_tile(x, y, z, tile):
708 gridmap.set_cell_item(mapvec.x, mapvec.y, mapvec.z, mesh_library.find_item_by_name(tile)) 731 gridmap.set_cell_item(mapvec.x, mapvec.y, mapvec.z, mesh_library.find_item_by_name(tile))
709 732
710 733
734func clear_gridmap_tile(x, y, z):
735 var gridmap = self.get_node("GridMap")
736 var mesh_library = gridmap.mesh_library
737 var mapvec = gridmap.world_to_map(gridmap.to_local(Vector3(x, y, z)))
738
739 gridmap.set_cell_item(mapvec.x, mapvec.y, mapvec.z, GridMap.INVALID_CELL_ITEM)
740
741
711func set_small_gridmap_tile(x, y, z, tile): 742func set_small_gridmap_tile(x, y, z, tile):
712 var gridmap = self.get_node("GridMapSmall") 743 var gridmap = self.get_node("GridMapSmall")
713 var mesh_library = gridmap.mesh_library 744 var mesh_library = gridmap.mesh_library
diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index ce5a642..476d834 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd
@@ -42,7 +42,7 @@ func evaluate_solvability():
42 solvable = false 42 solvable = false
43 43
44 if solvable: 44 if solvable:
45 if effects.atbash_activated: 45 if effects.atbash_remaining > 0:
46 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text 46 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text
47 else: 47 else:
48 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text 48 self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text
diff --git a/Archipelago/panelEnd.gd b/Archipelago/panelEnd.gd index 81f07d6..136777d 100644 --- a/Archipelago/panelEnd.gd +++ b/Archipelago/panelEnd.gd
@@ -4,4 +4,4 @@ extends "res://scripts/panelEnd.gd"
4func handle_correct(): 4func handle_correct():
5 # We don't call the base method because we want to suppress the original 5 # We don't call the base method because we want to suppress the original
6 # behaviour. 6 # behaviour.
7 global.solved -= 1 7 pass
diff --git a/Archipelago/panelLevelSwitch.gd b/Archipelago/panelLevelSwitch.gd index 06df02b..8c369ef 100644 --- a/Archipelago/panelLevelSwitch.gd +++ b/Archipelago/panelLevelSwitch.gd
@@ -4,4 +4,4 @@ extends "res://scripts/panelLevelSwitch.gd"
4func handle_correct(): 4func handle_correct():
5 # We don't call the base method because we want to suppress the original 5 # We don't call the base method because we want to suppress the original
6 # behaviour. 6 # behaviour.
7 global.solved -= 1 7 pass