From b413e5a9c5d5e5e6eff63a74fbb3ecdabf2cc66f Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 2 Nov 2025 13:07:30 -0500 Subject: Prioritize hinted locations in tracker --- apworld/client/textclient.gd | 48 +++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 14 deletions(-) (limited to 'apworld/client/textclient.gd') diff --git a/apworld/client/textclient.gd b/apworld/client/textclient.gd index 8356f92..ce28a3a 100644 --- a/apworld/client/textclient.gd +++ b/apworld/client/textclient.gd @@ -17,6 +17,7 @@ var tracker_port_tree_item_by_id = {} var tracker_goal_tree_item = null var tracker_object_by_index = {} var tracker_object_by_ignored_index = {} +var tracker_ignored_group = null var worldports_tab var worldports_tree @@ -212,6 +213,7 @@ func update_locations(reset_locations = true): "type": kLocation, "id": location_id, "ignored": ap._ignored_locations.has(location_id), + "hint": ap.client._hinted_locations.has(location_id), } ) ) @@ -227,13 +229,12 @@ func update_locations(reset_locations = true): "type": kWorldport, "id": port_id, "ignored": false, + "hint": false, } ) ) - locations.sort_custom( - func(a, b): return a["name"] < b["name"] if a["ignored"] == b["ignored"] else !a["ignored"] - ) + locations.sort_custom(_cmp_tracker_objects) if ap.client._goal_accessible: var location_name = gamedata.ending_display_name_by_name[ap.kEndingNameByVictoryValue[ @@ -246,6 +247,7 @@ func update_locations(reset_locations = true): "name": location_name, "type": kGoal, "ignored": false, + "hint": false, } ) ) @@ -254,6 +256,8 @@ func update_locations(reset_locations = true): for location in locations: if count < 18 and not location["ignored"]: locations_overlay.push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT) + if location["hint"]: + locations_overlay.push_color(Color("#fafad2")) locations_overlay.append_text(location["name"]) locations_overlay.append_text(" ") if location["type"] == kLocation: @@ -262,6 +266,8 @@ func update_locations(reset_locations = true): locations_overlay.add_image(worldport_texture) elif location["type"] == kGoal: locations_overlay.add_image(goal_texture) + if location["hint"]: + locations_overlay.pop() locations_overlay.pop() count += 1 @@ -272,21 +278,20 @@ func update_locations(reset_locations = true): reset_tracker_tab() var root_ti = tracker_tree.create_item(null) - var ignored_loc_header = null for location in locations: var loc_row if location["ignored"]: - if ignored_loc_header == null: - ignored_loc_header = root_ti.create_child() - ignored_loc_header.set_text(1, "Ignored Locations") - ignored_loc_header.set_selectable(0, false) - ignored_loc_header.set_selectable(1, false) - ignored_loc_header.set_selectable(2, false) - ignored_loc_header.set_selectable(3, false) - - loc_row = ignored_loc_header.create_child() + if tracker_ignored_group == null: + tracker_ignored_group = root_ti.create_child() + tracker_ignored_group.set_text(1, "Ignored Locations") + tracker_ignored_group.set_selectable(0, false) + tracker_ignored_group.set_selectable(1, false) + tracker_ignored_group.set_selectable(2, false) + tracker_ignored_group.set_selectable(3, false) + + loc_row = tracker_ignored_group.create_child() else: loc_row = root_ti.create_child() @@ -294,6 +299,8 @@ func update_locations(reset_locations = true): loc_row.set_selectable(0, false) loc_row.set_text(1, location["name"]) loc_row.set_selectable(1, false) + if location["hint"]: + loc_row.set_custom_color(1, Color("#fafad2")) loc_row.set_cell_mode(2, TreeItem.CELL_MODE_CUSTOM) loc_row.set_text(2, "Show Path") loc_row.set_custom_as_button(2, true) @@ -346,6 +353,18 @@ func update_locations(reset_locations = true): if tracker_goal_tree_item != null and ap.client._goal_accessible: tracker_goal_tree_item.visible = true + if tracker_ignored_group != null: + tracker_ignored_group.visible = true + + +func _cmp_tracker_objects(a, b) -> bool: + if a["ignored"] != b["ignored"]: + return !a["ignored"] + elif a["hint"] != b["hint"]: + return a["hint"] + else: + return a["name"] < b["name"] + func update_locations_visibility(): var ap = global.get_node("Archipelago") @@ -372,7 +391,7 @@ func _on_tracker_button_clicked(): ap.client.getLogicalPath(type_str, tracker_object.get("id", null)) elif tracker_tree.get_edited_column() == 3: ap.toggle_ignored_location(tracker_object["id"]) - else: + elif edited_item.get_parent() == tracker_ignored_group: # This is the ignored locations group. if ( tracker_object_by_ignored_index.has(edited_index) @@ -485,4 +504,5 @@ func reset_tracker_tab(): tracker_goal_tree_item = null tracker_object_by_index.clear() tracker_object_by_ignored_index.clear() + tracker_ignored_group = null tracker_tree.clear() -- cgit 1.4.1