diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-11-02 12:29:29 -0500 | 
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-11-02 12:29:29 -0500 | 
| commit | adfc639965b2bda776ceb0a20840438e31f82d58 (patch) | |
| tree | b31b6896dee65b66595e648139ba4e047258847b /apworld/client | |
| parent | a5dc6b35da0a790b59940992d2cb175c35946f19 (diff) | |
| download | lingo2-archipelago-adfc639965b2bda776ceb0a20840438e31f82d58.tar.gz lingo2-archipelago-adfc639965b2bda776ceb0a20840438e31f82d58.tar.bz2 lingo2-archipelago-adfc639965b2bda776ceb0a20840438e31f82d58.zip  | |
Allow ignoring locations in tracker
Diffstat (limited to 'apworld/client')
| -rw-r--r-- | apworld/client/client.gd | 16 | ||||
| -rw-r--r-- | apworld/client/manager.gd | 17 | ||||
| -rw-r--r-- | apworld/client/textclient.gd | 82 | 
3 files changed, 99 insertions, 16 deletions
| diff --git a/apworld/client/client.gd b/apworld/client/client.gd index ce5ac7e..54d3d67 100644 --- a/apworld/client/client.gd +++ b/apworld/client/client.gd | |||
| @@ -38,6 +38,7 @@ signal hint_received(message) | |||
| 38 | signal door_latched(id) | 38 | signal door_latched(id) | 
| 39 | signal accessible_locations_updated | 39 | signal accessible_locations_updated | 
| 40 | signal checked_locations_updated | 40 | signal checked_locations_updated | 
| 41 | signal ignored_locations_updated(locations) | ||
| 41 | signal checked_worldports_updated | 42 | signal checked_worldports_updated | 
| 42 | signal keyboard_update_received | 43 | signal keyboard_update_received | 
| 43 | 44 | ||
| @@ -199,6 +200,13 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo | |||
| 199 | 200 | ||
| 200 | door_latched.emit(iid) | 201 | door_latched.emit(iid) | 
| 201 | 202 | ||
| 203 | elif cmd == "SetIgnoredLocations": | ||
| 204 | var locs = [] | ||
| 205 | for id in message["locations"]: | ||
| 206 | locs.append(int(id)) | ||
| 207 | |||
| 208 | ignored_locations_updated.emit(locs) | ||
| 209 | |||
| 202 | 210 | ||
| 203 | func connectToServer(server, un, pw): | 211 | func connectToServer(server, un, pw): | 
| 204 | sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}]) | 212 | sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}]) | 
| @@ -280,6 +288,14 @@ func getLogicalPath(object_type, object_id): | |||
| 280 | sendMessage([msg]) | 288 | sendMessage([msg]) | 
| 281 | 289 | ||
| 282 | 290 | ||
| 291 | func addIgnoredLocation(loc_id): | ||
| 292 | sendMessage([{"cmd": "IgnoreLocation", "id": loc_id}]) | ||
| 293 | |||
| 294 | |||
| 295 | func removeIgnoredLocation(loc_id): | ||
| 296 | sendMessage([{"cmd": "UnignoreLocation", "id": loc_id}]) | ||
| 297 | |||
| 298 | |||
| 283 | func sendQuit(): | 299 | func sendQuit(): | 
| 284 | sendMessage([{"cmd": "Quit"}]) | 300 | sendMessage([{"cmd": "Quit"}]) | 
| 285 | 301 | ||
| diff --git a/apworld/client/manager.gd b/apworld/client/manager.gd index 727d17a..b7bb5fd 100644 --- a/apworld/client/manager.gd +++ b/apworld/client/manager.gd | |||
| @@ -29,6 +29,7 @@ var _inverse_item_locks = {} | |||
| 29 | var _held_letters = {} | 29 | var _held_letters = {} | 
| 30 | var _letters_setup = false | 30 | var _letters_setup = false | 
| 31 | var _already_connected = false | 31 | var _already_connected = false | 
| 32 | var _ignored_locations = [] | ||
| 32 | 33 | ||
| 33 | const kSHUFFLE_LETTERS_VANILLA = 0 | 34 | const kSHUFFLE_LETTERS_VANILLA = 0 | 
| 34 | const kSHUFFLE_LETTERS_UNLOCKED = 1 | 35 | const kSHUFFLE_LETTERS_UNLOCKED = 1 | 
| @@ -144,6 +145,7 @@ func _ready(): | |||
| 144 | client.hint_received.connect(_process_hint_received) | 145 | client.hint_received.connect(_process_hint_received) | 
| 145 | client.accessible_locations_updated.connect(_on_accessible_locations_updated) | 146 | client.accessible_locations_updated.connect(_on_accessible_locations_updated) | 
| 146 | client.checked_locations_updated.connect(_on_checked_locations_updated) | 147 | client.checked_locations_updated.connect(_on_checked_locations_updated) | 
| 148 | client.ignored_locations_updated.connect(_on_ignored_locations_updated) | ||
| 147 | client.checked_worldports_updated.connect(_on_checked_worldports_updated) | 149 | client.checked_worldports_updated.connect(_on_checked_worldports_updated) | 
| 148 | client.door_latched.connect(_on_door_latched) | 150 | client.door_latched.connect(_on_door_latched) | 
| 149 | 151 | ||
| @@ -384,6 +386,14 @@ func _on_checked_worldports_updated(): | |||
| 384 | textclient_node.update_worldports() | 386 | textclient_node.update_worldports() | 
| 385 | 387 | ||
| 386 | 388 | ||
| 389 | func _on_ignored_locations_updated(locations): | ||
| 390 | _ignored_locations = locations | ||
| 391 | |||
| 392 | var textclient_node = global.get_node("Textclient") | ||
| 393 | if textclient_node != null: | ||
| 394 | textclient_node.update_locations() | ||
| 395 | |||
| 396 | |||
| 387 | func _on_door_latched(door_id): | 397 | func _on_door_latched(door_id): | 
| 388 | var gamedata = global.get_node("Gamedata") | 398 | var gamedata = global.get_node("Gamedata") | 
| 389 | if gamedata.get_door_map_name(door_id) != global.map: | 399 | if gamedata.get_door_map_name(door_id) != global.map: | 
| @@ -677,3 +687,10 @@ func update_job_well_done_sign(): | |||
| 677 | 687 | ||
| 678 | sign2.get_node("MeshInstance3D").mesh.text = sign2.text | 688 | sign2.get_node("MeshInstance3D").mesh.text = sign2.text | 
| 679 | sign3.get_node("MeshInstance3D").mesh.text = sign3.text | 689 | sign3.get_node("MeshInstance3D").mesh.text = sign3.text | 
| 690 | |||
| 691 | |||
| 692 | func toggle_ignored_location(loc_id): | ||
| 693 | if loc_id in _ignored_locations: | ||
| 694 | client.removeIgnoredLocation(loc_id) | ||
| 695 | else: | ||
| 696 | client.addIgnoredLocation(loc_id) | ||
| diff --git a/apworld/client/textclient.gd b/apworld/client/textclient.gd index f785a03..8356f92 100644 --- a/apworld/client/textclient.gd +++ b/apworld/client/textclient.gd | |||
| @@ -16,6 +16,7 @@ var tracker_loc_tree_item_by_id = {} | |||
| 16 | var tracker_port_tree_item_by_id = {} | 16 | var tracker_port_tree_item_by_id = {} | 
| 17 | var tracker_goal_tree_item = null | 17 | var tracker_goal_tree_item = null | 
| 18 | var tracker_object_by_index = {} | 18 | var tracker_object_by_index = {} | 
| 19 | var tracker_object_by_ignored_index = {} | ||
| 19 | 20 | ||
| 20 | var worldports_tab | 21 | var worldports_tab | 
| 21 | var worldports_tree | 22 | var worldports_tree | 
| @@ -99,7 +100,7 @@ func _ready(): | |||
| 99 | tabs.add_child(tracker_margins) | 100 | tabs.add_child(tracker_margins) | 
| 100 | 101 | ||
| 101 | tracker_tree = Tree.new() | 102 | tracker_tree = Tree.new() | 
| 102 | tracker_tree.columns = 3 | 103 | tracker_tree.columns = 4 | 
| 103 | tracker_tree.hide_root = true | 104 | tracker_tree.hide_root = true | 
| 104 | tracker_tree.add_theme_font_size_override("font_size", 24) | 105 | tracker_tree.add_theme_font_size_override("font_size", 24) | 
| 105 | tracker_tree.add_theme_color_override("font_color", Color(0.8, 0.8, 0.8, 1)) | 106 | tracker_tree.add_theme_color_override("font_color", Color(0.8, 0.8, 0.8, 1)) | 
| @@ -108,7 +109,9 @@ func _ready(): | |||
| 108 | tracker_tree.set_column_expand(0, false) | 109 | tracker_tree.set_column_expand(0, false) | 
| 109 | tracker_tree.set_column_expand(1, true) | 110 | tracker_tree.set_column_expand(1, true) | 
| 110 | tracker_tree.set_column_expand(2, false) | 111 | tracker_tree.set_column_expand(2, false) | 
| 112 | tracker_tree.set_column_expand(3, false) | ||
| 111 | tracker_tree.set_column_custom_minimum_width(2, 200) | 113 | tracker_tree.set_column_custom_minimum_width(2, 200) | 
| 114 | tracker_tree.set_column_custom_minimum_width(3, 200) | ||
| 112 | tracker_margins.add_child(tracker_tree) | 115 | tracker_margins.add_child(tracker_tree) | 
| 113 | 116 | ||
| 114 | worldports_tab = MarginContainer.new() | 117 | worldports_tab = MarginContainer.new() | 
| @@ -208,6 +211,7 @@ func update_locations(reset_locations = true): | |||
| 208 | "name": location_name, | 211 | "name": location_name, | 
| 209 | "type": kLocation, | 212 | "type": kLocation, | 
| 210 | "id": location_id, | 213 | "id": location_id, | 
| 214 | "ignored": ap._ignored_locations.has(location_id), | ||
| 211 | } | 215 | } | 
| 212 | ) | 216 | ) | 
| 213 | ) | 217 | ) | 
| @@ -222,11 +226,14 @@ func update_locations(reset_locations = true): | |||
| 222 | "name": port_name, | 226 | "name": port_name, | 
| 223 | "type": kWorldport, | 227 | "type": kWorldport, | 
| 224 | "id": port_id, | 228 | "id": port_id, | 
| 229 | "ignored": false, | ||
| 225 | } | 230 | } | 
| 226 | ) | 231 | ) | 
| 227 | ) | 232 | ) | 
| 228 | 233 | ||
| 229 | locations.sort_custom(func(a, b): return a["name"] < b["name"]) | 234 | locations.sort_custom( | 
| 235 | func(a, b): return a["name"] < b["name"] if a["ignored"] == b["ignored"] else !a["ignored"] | ||
| 236 | ) | ||
| 230 | 237 | ||
| 231 | if ap.client._goal_accessible: | 238 | if ap.client._goal_accessible: | 
| 232 | var location_name = gamedata.ending_display_name_by_name[ap.kEndingNameByVictoryValue[ | 239 | var location_name = gamedata.ending_display_name_by_name[ap.kEndingNameByVictoryValue[ | 
| @@ -238,13 +245,14 @@ func update_locations(reset_locations = true): | |||
| 238 | { | 245 | { | 
| 239 | "name": location_name, | 246 | "name": location_name, | 
| 240 | "type": kGoal, | 247 | "type": kGoal, | 
| 248 | "ignored": false, | ||
| 241 | } | 249 | } | 
| 242 | ) | 250 | ) | 
| 243 | ) | 251 | ) | 
| 244 | 252 | ||
| 245 | var count = 0 | 253 | var count = 0 | 
| 246 | for location in locations: | 254 | for location in locations: | 
| 247 | if count < 18: | 255 | if count < 18 and not location["ignored"]: | 
| 248 | locations_overlay.push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT) | 256 | locations_overlay.push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT) | 
| 249 | locations_overlay.append_text(location["name"]) | 257 | locations_overlay.append_text(location["name"]) | 
| 250 | locations_overlay.append_text(" ") | 258 | locations_overlay.append_text(" ") | 
| @@ -264,9 +272,24 @@ func update_locations(reset_locations = true): | |||
| 264 | reset_tracker_tab() | 272 | reset_tracker_tab() | 
| 265 | 273 | ||
| 266 | var root_ti = tracker_tree.create_item(null) | 274 | var root_ti = tracker_tree.create_item(null) | 
| 275 | var ignored_loc_header = null | ||
| 267 | 276 | ||
| 268 | for location in locations: | 277 | for location in locations: | 
| 269 | var loc_row = root_ti.create_child() | 278 | var loc_row | 
| 279 | |||
| 280 | if location["ignored"]: | ||
| 281 | if ignored_loc_header == null: | ||
| 282 | ignored_loc_header = root_ti.create_child() | ||
| 283 | ignored_loc_header.set_text(1, "Ignored Locations") | ||
| 284 | ignored_loc_header.set_selectable(0, false) | ||
| 285 | ignored_loc_header.set_selectable(1, false) | ||
| 286 | ignored_loc_header.set_selectable(2, false) | ||
| 287 | ignored_loc_header.set_selectable(3, false) | ||
| 288 | |||
| 289 | loc_row = ignored_loc_header.create_child() | ||
| 290 | else: | ||
| 291 | loc_row = root_ti.create_child() | ||
| 292 | |||
| 270 | loc_row.set_cell_mode(0, TreeItem.CELL_MODE_ICON) | 293 | loc_row.set_cell_mode(0, TreeItem.CELL_MODE_ICON) | 
| 271 | loc_row.set_selectable(0, false) | 294 | loc_row.set_selectable(0, false) | 
| 272 | loc_row.set_text(1, location["name"]) | 295 | loc_row.set_text(1, location["name"]) | 
| @@ -277,6 +300,16 @@ func update_locations(reset_locations = true): | |||
| 277 | loc_row.set_editable(2, true) | 300 | loc_row.set_editable(2, true) | 
| 278 | loc_row.set_selectable(2, false) | 301 | loc_row.set_selectable(2, false) | 
| 279 | loc_row.set_text_alignment(2, HORIZONTAL_ALIGNMENT_CENTER) | 302 | loc_row.set_text_alignment(2, HORIZONTAL_ALIGNMENT_CENTER) | 
| 303 | loc_row.set_selectable(3, false) | ||
| 304 | if location["type"] == kLocation: | ||
| 305 | loc_row.set_cell_mode(3, TreeItem.CELL_MODE_CUSTOM) | ||
| 306 | if location["ignored"]: | ||
| 307 | loc_row.set_text(3, "Unignore") | ||
| 308 | else: | ||
| 309 | loc_row.set_text(3, "Ignore") | ||
| 310 | loc_row.set_custom_as_button(3, true) | ||
| 311 | loc_row.set_editable(3, true) | ||
| 312 | loc_row.set_text_alignment(3, HORIZONTAL_ALIGNMENT_CENTER) | ||
| 280 | 313 | ||
| 281 | if location["type"] == kLocation: | 314 | if location["type"] == kLocation: | 
| 282 | loc_row.set_icon(0, location_texture) | 315 | loc_row.set_icon(0, location_texture) | 
| @@ -288,7 +321,10 @@ func update_locations(reset_locations = true): | |||
| 288 | loc_row.set_icon(0, goal_texture) | 321 | loc_row.set_icon(0, goal_texture) | 
| 289 | tracker_goal_tree_item = loc_row | 322 | tracker_goal_tree_item = loc_row | 
| 290 | 323 | ||
| 291 | tracker_object_by_index[loc_row.get_index()] = location | 324 | if location["ignored"]: | 
| 325 | tracker_object_by_ignored_index[loc_row.get_index()] = location | ||
| 326 | else: | ||
| 327 | tracker_object_by_index[loc_row.get_index()] = location | ||
| 292 | else: | 328 | else: | 
| 293 | for loc_row in tracker_tree.get_root().get_children(): | 329 | for loc_row in tracker_tree.get_root().get_children(): | 
| 294 | loc_row.visible = false | 330 | loc_row.visible = false | 
| @@ -317,20 +353,33 @@ func update_locations_visibility(): | |||
| 317 | 353 | ||
| 318 | 354 | ||
| 319 | func _on_tracker_button_clicked(): | 355 | func _on_tracker_button_clicked(): | 
| 356 | var ap = global.get_node("Archipelago") | ||
| 357 | |||
| 320 | var edited_item = tracker_tree.get_edited() | 358 | var edited_item = tracker_tree.get_edited() | 
| 321 | var edited_index = edited_item.get_index() | 359 | var edited_index = edited_item.get_index() | 
| 322 | 360 | ||
| 323 | if tracker_object_by_index.has(edited_index): | 361 | if edited_item.get_parent() == tracker_tree.get_root(): | 
| 324 | var tracker_object = tracker_object_by_index[edited_index] | 362 | if tracker_object_by_index.has(edited_index): | 
| 325 | var ap = global.get_node("Archipelago") | 363 | var tracker_object = tracker_object_by_index[edited_index] | 
| 326 | var type_str = "" | 364 | if tracker_tree.get_edited_column() == 2: | 
| 327 | if tracker_object["type"] == kLocation: | 365 | var type_str = "" | 
| 328 | type_str = "location" | 366 | if tracker_object["type"] == kLocation: | 
| 329 | elif tracker_object["type"] == kWorldport: | 367 | type_str = "location" | 
| 330 | type_str = "worldport" | 368 | elif tracker_object["type"] == kWorldport: | 
| 331 | elif tracker_object["type"] == kGoal: | 369 | type_str = "worldport" | 
| 332 | type_str = "goal" | 370 | elif tracker_object["type"] == kGoal: | 
| 333 | ap.client.getLogicalPath(type_str, tracker_object.get("id", null)) | 371 | type_str = "goal" | 
| 372 | ap.client.getLogicalPath(type_str, tracker_object.get("id", null)) | ||
| 373 | elif tracker_tree.get_edited_column() == 3: | ||
| 374 | ap.toggle_ignored_location(tracker_object["id"]) | ||
| 375 | else: | ||
| 376 | # This is the ignored locations group. | ||
| 377 | if ( | ||
| 378 | tracker_object_by_ignored_index.has(edited_index) | ||
| 379 | and tracker_tree.get_edited_column() == 3 | ||
| 380 | ): | ||
| 381 | var tracker_object = tracker_object_by_ignored_index[edited_index] | ||
| 382 | ap.toggle_ignored_location(tracker_object["id"]) | ||
| 334 | 383 | ||
| 335 | 384 | ||
| 336 | func display_logical_path(object_type, object_id, paths): | 385 | func display_logical_path(object_type, object_id, paths): | 
| @@ -435,4 +484,5 @@ func reset_tracker_tab(): | |||
| 435 | tracker_port_tree_item_by_id.clear() | 484 | tracker_port_tree_item_by_id.clear() | 
| 436 | tracker_goal_tree_item = null | 485 | tracker_goal_tree_item = null | 
| 437 | tracker_object_by_index.clear() | 486 | tracker_object_by_index.clear() | 
| 487 | tracker_object_by_ignored_index.clear() | ||
| 438 | tracker_tree.clear() | 488 | tracker_tree.clear() | 
