diff options
Diffstat (limited to 'apworld/client')
-rw-r--r-- | apworld/client/assets/location.png | bin | 0 -> 311 bytes | |||
-rw-r--r-- | apworld/client/assets/worldport.png | bin | 0 -> 219 bytes | |||
-rw-r--r-- | apworld/client/client.gd | 48 | ||||
-rw-r--r-- | apworld/client/gamedata.gd | 12 | ||||
-rw-r--r-- | apworld/client/keyboard.gd | 36 | ||||
-rw-r--r-- | apworld/client/manager.gd | 14 | ||||
-rw-r--r-- | apworld/client/textclient.gd | 127 | ||||
-rw-r--r-- | apworld/client/worldport.gd | 10 |
8 files changed, 229 insertions, 18 deletions
diff --git a/apworld/client/assets/location.png b/apworld/client/assets/location.png new file mode 100644 index 0000000..5304deb --- /dev/null +++ b/apworld/client/assets/location.png | |||
Binary files differ | |||
diff --git a/apworld/client/assets/worldport.png b/apworld/client/assets/worldport.png new file mode 100644 index 0000000..19dfdc3 --- /dev/null +++ b/apworld/client/assets/worldport.png | |||
Binary files differ | |||
diff --git a/apworld/client/client.gd b/apworld/client/client.gd index 286ad4b..a23e85a 100644 --- a/apworld/client/client.gd +++ b/apworld/client/client.gd | |||
@@ -18,10 +18,12 @@ var _seed = "" | |||
18 | var _team = 0 | 18 | var _team = 0 |
19 | var _slot = 0 | 19 | var _slot = 0 |
20 | var _checked_locations = [] | 20 | var _checked_locations = [] |
21 | var _checked_worldports = [] | ||
21 | var _received_indexes = [] | 22 | var _received_indexes = [] |
22 | var _received_items = {} | 23 | var _received_items = {} |
23 | var _slot_data = {} | 24 | var _slot_data = {} |
24 | var _accessible_locations = [] | 25 | var _accessible_locations = [] |
26 | var _accessible_worldports = [] | ||
25 | 27 | ||
26 | signal could_not_connect | 28 | signal could_not_connect |
27 | signal connect_status | 29 | signal connect_status |
@@ -33,6 +35,8 @@ signal item_sent_notification(message) | |||
33 | signal hint_received(message) | 35 | signal hint_received(message) |
34 | signal accessible_locations_updated | 36 | signal accessible_locations_updated |
35 | signal checked_locations_updated | 37 | signal checked_locations_updated |
38 | signal checked_worldports_updated | ||
39 | signal keyboard_update_received | ||
36 | 40 | ||
37 | 41 | ||
38 | func _init(): | 42 | func _init(): |
@@ -54,7 +58,9 @@ func _reset_state(): | |||
54 | _should_process = false | 58 | _should_process = false |
55 | _received_items = {} | 59 | _received_items = {} |
56 | _received_indexes = [] | 60 | _received_indexes = [] |
61 | _checked_worldports = [] | ||
57 | _accessible_locations = [] | 62 | _accessible_locations = [] |
63 | _accessible_worldports = [] | ||
58 | 64 | ||
59 | 65 | ||
60 | func disconnect_from_ap(): | 66 | func disconnect_from_ap(): |
@@ -116,6 +122,14 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo | |||
116 | 122 | ||
117 | checked_locations_updated.emit() | 123 | checked_locations_updated.emit() |
118 | 124 | ||
125 | elif cmd == "UpdateWorldports": | ||
126 | for port_id in message["worldports"]: | ||
127 | var lint = int(port_id) | ||
128 | if not _checked_worldports.has(lint): | ||
129 | _checked_worldports.append(lint) | ||
130 | |||
131 | checked_worldports_updated.emit() | ||
132 | |||
119 | elif cmd == "ItemReceived": | 133 | elif cmd == "ItemReceived": |
120 | for item in message["items"]: | 134 | for item in message["items"]: |
121 | var index = int(item["index"]) | 135 | var index = int(item["index"]) |
@@ -151,12 +165,24 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo | |||
151 | 165 | ||
152 | elif cmd == "AccessibleLocations": | 166 | elif cmd == "AccessibleLocations": |
153 | _accessible_locations.clear() | 167 | _accessible_locations.clear() |
168 | _accessible_worldports.clear() | ||
154 | 169 | ||
155 | for loc in message["locations"]: | 170 | for loc in message["locations"]: |
156 | _accessible_locations.append(int(loc)) | 171 | _accessible_locations.append(int(loc)) |
157 | 172 | ||
173 | if "worldports" in message: | ||
174 | for port_id in message["worldports"]: | ||
175 | _accessible_worldports.append(int(port_id)) | ||
176 | |||
158 | accessible_locations_updated.emit() | 177 | accessible_locations_updated.emit() |
159 | 178 | ||
179 | elif cmd == "UpdateKeyboard": | ||
180 | var updates = {} | ||
181 | for k in message["updates"]: | ||
182 | updates[k] = int(message["updates"][k]) | ||
183 | |||
184 | keyboard_update_received.emit(updates) | ||
185 | |||
160 | 186 | ||
161 | func connectToServer(server, un, pw): | 187 | func connectToServer(server, un, pw): |
162 | sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}]) | 188 | sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}]) |
@@ -202,19 +228,6 @@ func sendLocations(loc_ids): | |||
202 | sendMessage([{"cmd": "LocationChecks", "locations": loc_ids}]) | 228 | sendMessage([{"cmd": "LocationChecks", "locations": loc_ids}]) |
203 | 229 | ||
204 | 230 | ||
205 | func setValue(key, value, operation = "replace"): | ||
206 | sendMessage( | ||
207 | [ | ||
208 | { | ||
209 | "cmd": "Set", | ||
210 | "key": "Lingo2_%d_%s" % [_slot, key], | ||
211 | "want_reply": false, | ||
212 | "operations": [{"operation": operation, "value": value}] | ||
213 | } | ||
214 | ] | ||
215 | ) | ||
216 | |||
217 | |||
218 | func say(textdata): | 231 | func say(textdata): |
219 | sendMessage([{"cmd": "Say", "text": textdata}]) | 232 | sendMessage([{"cmd": "Say", "text": textdata}]) |
220 | 233 | ||
@@ -227,6 +240,15 @@ func scoutLocations(loc_ids): | |||
227 | sendMessage([{"cmd": "LocationScouts", "locations": loc_ids}]) | 240 | sendMessage([{"cmd": "LocationScouts", "locations": loc_ids}]) |
228 | 241 | ||
229 | 242 | ||
243 | func updateKeyboard(updates): | ||
244 | sendMessage([{"cmd": "UpdateKeyboard", "keyboard": updates}]) | ||
245 | |||
246 | |||
247 | func checkWorldport(port_id): | ||
248 | if not _checked_worldports.has(port_id): | ||
249 | sendMessage([{"cmd": "CheckWorldport", "port_id": port_id}]) | ||
250 | |||
251 | |||
230 | func sendQuit(): | 252 | func sendQuit(): |
231 | sendMessage([{"cmd": "Quit"}]) | 253 | sendMessage([{"cmd": "Quit"}]) |
232 | 254 | ||
diff --git a/apworld/client/gamedata.gd b/apworld/client/gamedata.gd index 39e0583..1424721 100644 --- a/apworld/client/gamedata.gd +++ b/apworld/client/gamedata.gd | |||
@@ -161,11 +161,23 @@ func get_door_ap_id(door_id): | |||
161 | return null | 161 | return null |
162 | 162 | ||
163 | 163 | ||
164 | func get_door_map_name(door_id): | ||
165 | var door = objects.get_doors()[door_id] | ||
166 | var room = objects.get_rooms()[door.get_room_id()] | ||
167 | var map = objects.get_maps()[room.get_map_id()] | ||
168 | return map.get_name() | ||
169 | |||
170 | |||
164 | func get_door_receivers(door_id): | 171 | func get_door_receivers(door_id): |
165 | var door = objects.get_doors()[door_id] | 172 | var door = objects.get_doors()[door_id] |
166 | return door.get_receivers() | 173 | return door.get_receivers() |
167 | 174 | ||
168 | 175 | ||
176 | func get_worldport_display_name(port_id): | ||
177 | var port = objects.get_ports()[port_id] | ||
178 | return "%s - %s" % [_get_room_object_map_name(port), port.get_display_name()] | ||
179 | |||
180 | |||
169 | func _get_map_object_map_name(obj): | 181 | func _get_map_object_map_name(obj): |
170 | return objects.get_maps()[obj.get_map_id()].get_display_name() | 182 | return objects.get_maps()[obj.get_map_id()].get_display_name() |
171 | 183 | ||
diff --git a/apworld/client/keyboard.gd b/apworld/client/keyboard.gd index 450566d..a59c4d0 100644 --- a/apworld/client/keyboard.gd +++ b/apworld/client/keyboard.gd | |||
@@ -48,6 +48,9 @@ func load_seed(): | |||
48 | if localdata.size() > 2: | 48 | if localdata.size() > 2: |
49 | keyholder_state = localdata[2] | 49 | keyholder_state = localdata[2] |
50 | 50 | ||
51 | if not letters_saved.is_empty(): | ||
52 | ap.client.updateKeyboard(letters_saved) | ||
53 | |||
51 | for k in kALL_LETTERS: | 54 | for k in kALL_LETTERS: |
52 | var level = 0 | 55 | var level = 0 |
53 | 56 | ||
@@ -105,10 +108,20 @@ func update_unlocks(): | |||
105 | 108 | ||
106 | 109 | ||
107 | func collect_local_letter(key, level): | 110 | func collect_local_letter(key, level): |
108 | if level < 0 or level > 2 or level < letters_saved.get(key, 0): | 111 | var ap = global.get_node("Archipelago") |
112 | var true_level = 0 | ||
113 | |||
114 | if ap.get_letter_behavior(key, false) == ap.kLETTER_BEHAVIOR_VANILLA: | ||
115 | true_level += 1 | ||
116 | if level == 2 and ap.get_letter_behavior(key, true) == ap.kLETTER_BEHAVIOR_VANILLA: | ||
117 | true_level += 1 | ||
118 | |||
119 | if true_level < letters_saved.get(key, 0): | ||
109 | return | 120 | return |
110 | 121 | ||
111 | letters_saved[key] = level | 122 | letters_saved[key] = true_level |
123 | |||
124 | ap.client.updateKeyboard({key: true_level}) | ||
112 | 125 | ||
113 | if letters_blocked.has(key): | 126 | if letters_blocked.has(key): |
114 | letters_blocked.erase(key) | 127 | letters_blocked.erase(key) |
@@ -197,3 +210,22 @@ func reset_keyholders(): | |||
197 | save() | 210 | save() |
198 | 211 | ||
199 | return cleared_anything | 212 | return cleared_anything |
213 | |||
214 | |||
215 | func remote_keyboard_updated(updates): | ||
216 | var reverse = {} | ||
217 | var should_update = false | ||
218 | |||
219 | for k in updates: | ||
220 | if not letters_saved.has(k) or updates[k] > letters_saved[k]: | ||
221 | letters_saved[k] = updates[k] | ||
222 | should_update = true | ||
223 | elif updates[k] < letters_saved[k]: | ||
224 | reverse[k] = letters_saved[k] | ||
225 | |||
226 | if should_update: | ||
227 | update_unlocks() | ||
228 | |||
229 | if not reverse.is_empty(): | ||
230 | var ap = global.get_node("Archipelago") | ||
231 | ap.client.updateKeyboard(reverse) | ||
diff --git a/apworld/client/manager.gd b/apworld/client/manager.gd index e7765dd..5b731d2 100644 --- a/apworld/client/manager.gd +++ b/apworld/client/manager.gd | |||
@@ -109,6 +109,7 @@ func _ready(): | |||
109 | client.hint_received.connect(_process_hint_received) | 109 | client.hint_received.connect(_process_hint_received) |
110 | client.accessible_locations_updated.connect(_on_accessible_locations_updated) | 110 | client.accessible_locations_updated.connect(_on_accessible_locations_updated) |
111 | client.checked_locations_updated.connect(_on_checked_locations_updated) | 111 | client.checked_locations_updated.connect(_on_checked_locations_updated) |
112 | client.checked_worldports_updated.connect(_on_checked_worldports_updated) | ||
112 | 113 | ||
113 | client.could_not_connect.connect(_client_could_not_connect) | 114 | client.could_not_connect.connect(_client_could_not_connect) |
114 | client.connect_status.connect(_client_connect_status) | 115 | client.connect_status.connect(_client_connect_status) |
@@ -118,6 +119,7 @@ func _ready(): | |||
118 | 119 | ||
119 | keyboard = SCRIPT_keyboard.new() | 120 | keyboard = SCRIPT_keyboard.new() |
120 | add_child(keyboard) | 121 | add_child(keyboard) |
122 | client.keyboard_update_received.connect(keyboard.remote_keyboard_updated) | ||
121 | 123 | ||
122 | 124 | ||
123 | func saveSettings(): | 125 | func saveSettings(): |
@@ -194,6 +196,7 @@ func _process_item(item, amount): | |||
194 | if gamedata.get_door_map_name(lock[0]) != global.map: | 196 | if gamedata.get_door_map_name(lock[0]) != global.map: |
195 | continue | 197 | continue |
196 | 198 | ||
199 | # TODO: fix doors opening from door groups | ||
197 | var receivers = gamedata.get_door_receivers(lock[0]) | 200 | var receivers = gamedata.get_door_receivers(lock[0]) |
198 | var scene = get_tree().get_root().get_node_or_null("scene") | 201 | var scene = get_tree().get_root().get_node_or_null("scene") |
199 | if scene != null: | 202 | if scene != null: |
@@ -326,6 +329,13 @@ func _on_checked_locations_updated(): | |||
326 | textclient_node.update_locations() | 329 | textclient_node.update_locations() |
327 | 330 | ||
328 | 331 | ||
332 | func _on_checked_worldports_updated(): | ||
333 | var textclient_node = global.get_node("Textclient") | ||
334 | if textclient_node != null: | ||
335 | textclient_node.update_locations() | ||
336 | textclient_node.update_worldports() | ||
337 | |||
338 | |||
329 | func _client_could_not_connect(message): | 339 | func _client_could_not_connect(message): |
330 | could_not_connect.emit(message) | 340 | could_not_connect.emit(message) |
331 | 341 | ||
@@ -440,6 +450,10 @@ func _client_connected(slot_data): | |||
440 | 450 | ||
441 | _inverse_item_locks[lock[0]].append([door_id, lock[1]]) | 451 | _inverse_item_locks[lock[0]].append([door_id, lock[1]]) |
442 | 452 | ||
453 | if shuffle_worldports: | ||
454 | var textclient = global.get_node("Textclient") | ||
455 | textclient.setup_worldports() | ||
456 | |||
443 | ap_connected.emit() | 457 | ap_connected.emit() |
444 | 458 | ||
445 | 459 | ||
diff --git a/apworld/client/textclient.gd b/apworld/client/textclient.gd index 1b36c29..0c4e675 100644 --- a/apworld/client/textclient.gd +++ b/apworld/client/textclient.gd | |||
@@ -8,6 +8,13 @@ var tracker_label | |||
8 | var is_open = false | 8 | var is_open = false |
9 | 9 | ||
10 | var locations_overlay | 10 | var locations_overlay |
11 | var location_texture | ||
12 | var worldport_texture | ||
13 | |||
14 | var worldports_tab | ||
15 | var worldports_tree | ||
16 | var port_tree_item_by_map = {} | ||
17 | var port_tree_item_by_map_port = {} | ||
11 | 18 | ||
12 | 19 | ||
13 | func _ready(): | 20 | func _ready(): |
@@ -20,9 +27,10 @@ func _ready(): | |||
20 | locations_overlay.offset_bottom = 720 | 27 | locations_overlay.offset_bottom = 720 |
21 | locations_overlay.offset_left = 20 | 28 | locations_overlay.offset_left = 20 |
22 | locations_overlay.anchor_right = 1.0 | 29 | locations_overlay.anchor_right = 1.0 |
23 | locations_overlay.offset_right = -20 | 30 | locations_overlay.offset_right = -10 |
24 | locations_overlay.scroll_active = false | 31 | locations_overlay.scroll_active = false |
25 | locations_overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE | 32 | locations_overlay.mouse_filter = Control.MOUSE_FILTER_IGNORE |
33 | locations_overlay.texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST | ||
26 | add_child(locations_overlay) | 34 | add_child(locations_overlay) |
27 | update_locations_visibility() | 35 | update_locations_visibility() |
28 | 36 | ||
@@ -83,6 +91,31 @@ func _ready(): | |||
83 | tracker_label = RichTextLabel.new() | 91 | tracker_label = RichTextLabel.new() |
84 | tracker_margins.add_child(tracker_label) | 92 | tracker_margins.add_child(tracker_label) |
85 | 93 | ||
94 | worldports_tab = MarginContainer.new() | ||
95 | worldports_tab.name = "Worldports" | ||
96 | worldports_tab.add_theme_constant_override("margin_top", 60) | ||
97 | worldports_tab.add_theme_constant_override("margin_left", 60) | ||
98 | worldports_tab.add_theme_constant_override("margin_right", 60) | ||
99 | worldports_tab.add_theme_constant_override("margin_bottom", 60) | ||
100 | tabs.add_child(worldports_tab) | ||
101 | tabs.set_tab_hidden(2, true) | ||
102 | |||
103 | worldports_tree = Tree.new() | ||
104 | worldports_tree.columns = 2 | ||
105 | worldports_tree.hide_root = true | ||
106 | worldports_tree.theme = preload("res://assets/themes/baseUI.tres") | ||
107 | worldports_tree.add_theme_font_size_override("font_size", 24) | ||
108 | worldports_tab.add_child(worldports_tree) | ||
109 | |||
110 | var runtime = global.get_node("Runtime") | ||
111 | var location_image = Image.new() | ||
112 | location_image.load_png_from_buffer(runtime.read_path("assets/location.png")) | ||
113 | location_texture = ImageTexture.create_from_image(location_image) | ||
114 | |||
115 | var worldport_image = Image.new() | ||
116 | worldport_image.load_png_from_buffer(runtime.read_path("assets/worldport.png")) | ||
117 | worldport_texture = ImageTexture.create_from_image(worldport_image) | ||
118 | |||
86 | 119 | ||
87 | func _input(event): | 120 | func _input(event): |
88 | if global.loaded and event is InputEventKey and event.pressed: | 121 | if global.loaded and event is InputEventKey and event.pressed: |
@@ -144,11 +177,22 @@ func update_locations(): | |||
144 | locations_overlay.push_outline_color(Color(0, 0, 0, 1)) | 177 | locations_overlay.push_outline_color(Color(0, 0, 0, 1)) |
145 | locations_overlay.push_outline_size(2) | 178 | locations_overlay.push_outline_size(2) |
146 | 179 | ||
180 | const kLocation = 0 | ||
181 | const kWorldport = 1 | ||
182 | |||
147 | var location_names = [] | 183 | var location_names = [] |
184 | var type_by_name = {} | ||
148 | for location_id in ap.client._accessible_locations: | 185 | for location_id in ap.client._accessible_locations: |
149 | if not ap.client._checked_locations.has(location_id): | 186 | if not ap.client._checked_locations.has(location_id): |
150 | var location_name = gamedata.location_name_by_id.get(location_id, "(Unknown)") | 187 | var location_name = gamedata.location_name_by_id.get(location_id, "(Unknown)") |
151 | location_names.append(location_name) | 188 | location_names.append(location_name) |
189 | type_by_name[location_name] = kLocation | ||
190 | |||
191 | for port_id in ap.client._accessible_worldports: | ||
192 | if not ap.client._checked_worldports.has(port_id): | ||
193 | var port_name = gamedata.get_worldport_display_name(port_id) | ||
194 | location_names.append(port_name) | ||
195 | type_by_name[port_name] = kWorldport | ||
152 | 196 | ||
153 | location_names.sort() | 197 | location_names.sort() |
154 | 198 | ||
@@ -156,7 +200,14 @@ func update_locations(): | |||
156 | for location_name in location_names: | 200 | for location_name in location_names: |
157 | tracker_label.append_text("[p]%s[/p]" % location_name) | 201 | tracker_label.append_text("[p]%s[/p]" % location_name) |
158 | if count < 18: | 202 | if count < 18: |
159 | locations_overlay.append_text("[p align=right]%s[/p]" % location_name) | 203 | locations_overlay.push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT) |
204 | locations_overlay.append_text(location_name) | ||
205 | locations_overlay.append_text(" ") | ||
206 | if type_by_name[location_name] == kLocation: | ||
207 | locations_overlay.add_image(location_texture) | ||
208 | elif type_by_name[location_name] == kWorldport: | ||
209 | locations_overlay.add_image(worldport_texture) | ||
210 | locations_overlay.pop() | ||
160 | count += 1 | 211 | count += 1 |
161 | 212 | ||
162 | if count > 18: | 213 | if count > 18: |
@@ -168,5 +219,77 @@ func update_locations_visibility(): | |||
168 | locations_overlay.visible = ap.show_locations | 219 | locations_overlay.visible = ap.show_locations |
169 | 220 | ||
170 | 221 | ||
222 | func setup_worldports(): | ||
223 | tabs.set_tab_hidden(2, false) | ||
224 | |||
225 | var root_ti = worldports_tree.create_item(null) | ||
226 | |||
227 | var ports_by_map_id = {} | ||
228 | var display_names_by_map_id = {} | ||
229 | var display_names_by_port_id = {} | ||
230 | |||
231 | var ap = global.get_node("Archipelago") | ||
232 | var gamedata = global.get_node("Gamedata") | ||
233 | for fpid in ap.port_pairings: | ||
234 | var port = gamedata.objects.get_ports()[fpid] | ||
235 | var room = gamedata.objects.get_rooms()[port.get_room_id()] | ||
236 | |||
237 | if not ports_by_map_id.has(room.get_map_id()): | ||
238 | ports_by_map_id[room.get_map_id()] = [] | ||
239 | |||
240 | var map = gamedata.objects.get_maps()[room.get_map_id()] | ||
241 | display_names_by_map_id[map.get_id()] = map.get_display_name() | ||
242 | |||
243 | ports_by_map_id[room.get_map_id()].append(fpid) | ||
244 | display_names_by_port_id[fpid] = port.get_display_name() | ||
245 | |||
246 | var sorted_map_ids = ports_by_map_id.keys().duplicate() | ||
247 | sorted_map_ids.sort_custom( | ||
248 | func(a, b): return display_names_by_map_id[a] < display_names_by_map_id[b] | ||
249 | ) | ||
250 | |||
251 | for map_id in sorted_map_ids: | ||
252 | var map_ti = root_ti.create_child() | ||
253 | map_ti.set_text(0, display_names_by_map_id[map_id]) | ||
254 | map_ti.visible = false | ||
255 | map_ti.collapsed = true | ||
256 | port_tree_item_by_map[map_id] = map_ti | ||
257 | port_tree_item_by_map_port[map_id] = {} | ||
258 | |||
259 | var port_ids = ports_by_map_id[map_id] | ||
260 | port_ids.sort_custom( | ||
261 | func(a, b): return display_names_by_port_id[a] < display_names_by_port_id[b] | ||
262 | ) | ||
263 | |||
264 | for port_id in port_ids: | ||
265 | var port_ti = map_ti.create_child() | ||
266 | port_ti.set_text(0, display_names_by_port_id[port_id]) | ||
267 | port_ti.set_text(1, gamedata.get_worldport_display_name(ap.port_pairings[port_id])) | ||
268 | port_ti.visible = false | ||
269 | port_tree_item_by_map_port[map_id][port_id] = port_ti | ||
270 | |||
271 | update_worldports() | ||
272 | |||
273 | |||
274 | func update_worldports(): | ||
275 | var ap = global.get_node("Archipelago") | ||
276 | |||
277 | for map_id in port_tree_item_by_map_port.keys(): | ||
278 | var map_visible = false | ||
279 | |||
280 | for port_id in port_tree_item_by_map_port[map_id].keys(): | ||
281 | var ti = port_tree_item_by_map_port[map_id][port_id] | ||
282 | ti.visible = ap.client._checked_worldports.has(port_id) | ||
283 | |||
284 | if ti.visible: | ||
285 | map_visible = true | ||
286 | |||
287 | port_tree_item_by_map[map_id].visible = map_visible | ||
288 | |||
289 | |||
171 | func reset(): | 290 | func reset(): |
172 | locations_overlay.clear() | 291 | locations_overlay.clear() |
292 | tabs.set_tab_hidden(2, true) | ||
293 | port_tree_item_by_map.clear() | ||
294 | port_tree_item_by_map_port.clear() | ||
295 | worldports_tree.clear() | ||
diff --git a/apworld/client/worldport.gd b/apworld/client/worldport.gd index cdca248..ed9891e 100644 --- a/apworld/client/worldport.gd +++ b/apworld/client/worldport.gd | |||
@@ -3,6 +3,8 @@ extends "res://scripts/nodes/worldport.gd" | |||
3 | var absolute_rotation = false | 3 | var absolute_rotation = false |
4 | var target_rotation = 0 | 4 | var target_rotation = 0 |
5 | 5 | ||
6 | var port_id = null | ||
7 | |||
6 | 8 | ||
7 | func _ready(): | 9 | func _ready(): |
8 | var node_path = String( | 10 | var node_path = String( |
@@ -13,7 +15,7 @@ func _ready(): | |||
13 | 15 | ||
14 | if ap.shuffle_worldports: | 16 | if ap.shuffle_worldports: |
15 | var gamedata = global.get_node("Gamedata") | 17 | var gamedata = global.get_node("Gamedata") |
16 | var port_id = gamedata.get_port_for_map_node_path(global.map, node_path) | 18 | port_id = gamedata.get_port_for_map_node_path(global.map, node_path) |
17 | if port_id != null: | 19 | if port_id != null: |
18 | if port_id in ap.port_pairings: | 20 | if port_id in ap.port_pairings: |
19 | var target_port = gamedata.objects.get_ports()[ap.port_pairings[port_id]] | 21 | var target_port = gamedata.objects.get_ports()[ap.port_pairings[port_id]] |
@@ -29,6 +31,8 @@ func _ready(): | |||
29 | sets_entry_point = true | 31 | sets_entry_point = true |
30 | invisible = false | 32 | invisible = false |
31 | fades = true | 33 | fades = true |
34 | else: | ||
35 | port_id = null | ||
32 | 36 | ||
33 | if global.map == "icarus" and exit == "daedalus": | 37 | if global.map == "icarus" and exit == "daedalus": |
34 | if not ap.daedalus_roof_access: | 38 | if not ap.daedalus_roof_access: |
@@ -39,6 +43,10 @@ func _ready(): | |||
39 | 43 | ||
40 | func bodyEntered(body): | 44 | func bodyEntered(body): |
41 | if body.is_in_group("player"): | 45 | if body.is_in_group("player"): |
46 | if port_id != null: | ||
47 | var ap = global.get_node("Archipelago") | ||
48 | ap.client.checkWorldport(port_id) | ||
49 | |||
42 | if absolute_rotation: | 50 | if absolute_rotation: |
43 | entry_rotate.y = target_rotation - body.rotation_degrees.y | 51 | entry_rotate.y = target_rotation - body.rotation_degrees.y |
44 | 52 | ||