about summary refs log tree commit diff stats
path: root/apworld/client/textclient.gd
diff options
context:
space:
mode:
Diffstat (limited to 'apworld/client/textclient.gd')
-rw-r--r--apworld/client/textclient.gd48
1 files changed, 34 insertions, 14 deletions
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 = {}
17var tracker_goal_tree_item = null 17var tracker_goal_tree_item = null
18var tracker_object_by_index = {} 18var tracker_object_by_index = {}
19var tracker_object_by_ignored_index = {} 19var tracker_object_by_ignored_index = {}
20var tracker_ignored_group = null
20 21
21var worldports_tab 22var worldports_tab
22var worldports_tree 23var worldports_tree
@@ -212,6 +213,7 @@ func update_locations(reset_locations = true):
212 "type": kLocation, 213 "type": kLocation,
213 "id": location_id, 214 "id": location_id,
214 "ignored": ap._ignored_locations.has(location_id), 215 "ignored": ap._ignored_locations.has(location_id),
216 "hint": ap.client._hinted_locations.has(location_id),
215 } 217 }
216 ) 218 )
217 ) 219 )
@@ -227,13 +229,12 @@ func update_locations(reset_locations = true):
227 "type": kWorldport, 229 "type": kWorldport,
228 "id": port_id, 230 "id": port_id,
229 "ignored": false, 231 "ignored": false,
232 "hint": false,
230 } 233 }
231 ) 234 )
232 ) 235 )
233 236
234 locations.sort_custom( 237 locations.sort_custom(_cmp_tracker_objects)
235 func(a, b): return a["name"] < b["name"] if a["ignored"] == b["ignored"] else !a["ignored"]
236 )
237 238
238 if ap.client._goal_accessible: 239 if ap.client._goal_accessible:
239 var location_name = gamedata.ending_display_name_by_name[ap.kEndingNameByVictoryValue[ 240 var location_name = gamedata.ending_display_name_by_name[ap.kEndingNameByVictoryValue[
@@ -246,6 +247,7 @@ func update_locations(reset_locations = true):
246 "name": location_name, 247 "name": location_name,
247 "type": kGoal, 248 "type": kGoal,
248 "ignored": false, 249 "ignored": false,
250 "hint": false,
249 } 251 }
250 ) 252 )
251 ) 253 )
@@ -254,6 +256,8 @@ func update_locations(reset_locations = true):
254 for location in locations: 256 for location in locations:
255 if count < 18 and not location["ignored"]: 257 if count < 18 and not location["ignored"]:
256 locations_overlay.push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT) 258 locations_overlay.push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT)
259 if location["hint"]:
260 locations_overlay.push_color(Color("#fafad2"))
257 locations_overlay.append_text(location["name"]) 261 locations_overlay.append_text(location["name"])
258 locations_overlay.append_text(" ") 262 locations_overlay.append_text(" ")
259 if location["type"] == kLocation: 263 if location["type"] == kLocation:
@@ -262,6 +266,8 @@ func update_locations(reset_locations = true):
262 locations_overlay.add_image(worldport_texture) 266 locations_overlay.add_image(worldport_texture)
263 elif location["type"] == kGoal: 267 elif location["type"] == kGoal:
264 locations_overlay.add_image(goal_texture) 268 locations_overlay.add_image(goal_texture)
269 if location["hint"]:
270 locations_overlay.pop()
265 locations_overlay.pop() 271 locations_overlay.pop()
266 count += 1 272 count += 1
267 273
@@ -272,21 +278,20 @@ func update_locations(reset_locations = true):
272 reset_tracker_tab() 278 reset_tracker_tab()
273 279
274 var root_ti = tracker_tree.create_item(null) 280 var root_ti = tracker_tree.create_item(null)
275 var ignored_loc_header = null
276 281
277 for location in locations: 282 for location in locations:
278 var loc_row 283 var loc_row
279 284
280 if location["ignored"]: 285 if location["ignored"]:
281 if ignored_loc_header == null: 286 if tracker_ignored_group == null:
282 ignored_loc_header = root_ti.create_child() 287 tracker_ignored_group = root_ti.create_child()
283 ignored_loc_header.set_text(1, "Ignored Locations") 288 tracker_ignored_group.set_text(1, "Ignored Locations")
284 ignored_loc_header.set_selectable(0, false) 289 tracker_ignored_group.set_selectable(0, false)
285 ignored_loc_header.set_selectable(1, false) 290 tracker_ignored_group.set_selectable(1, false)
286 ignored_loc_header.set_selectable(2, false) 291 tracker_ignored_group.set_selectable(2, false)
287 ignored_loc_header.set_selectable(3, false) 292 tracker_ignored_group.set_selectable(3, false)
288 293
289 loc_row = ignored_loc_header.create_child() 294 loc_row = tracker_ignored_group.create_child()
290 else: 295 else:
291 loc_row = root_ti.create_child() 296 loc_row = root_ti.create_child()
292 297
@@ -294,6 +299,8 @@ func update_locations(reset_locations = true):
294 loc_row.set_selectable(0, false) 299 loc_row.set_selectable(0, false)
295 loc_row.set_text(1, location["name"]) 300 loc_row.set_text(1, location["name"])
296 loc_row.set_selectable(1, false) 301 loc_row.set_selectable(1, false)
302 if location["hint"]:
303 loc_row.set_custom_color(1, Color("#fafad2"))
297 loc_row.set_cell_mode(2, TreeItem.CELL_MODE_CUSTOM) 304 loc_row.set_cell_mode(2, TreeItem.CELL_MODE_CUSTOM)
298 loc_row.set_text(2, "Show Path") 305 loc_row.set_text(2, "Show Path")
299 loc_row.set_custom_as_button(2, true) 306 loc_row.set_custom_as_button(2, true)
@@ -346,6 +353,18 @@ func update_locations(reset_locations = true):
346 if tracker_goal_tree_item != null and ap.client._goal_accessible: 353 if tracker_goal_tree_item != null and ap.client._goal_accessible:
347 tracker_goal_tree_item.visible = true 354 tracker_goal_tree_item.visible = true
348 355
356 if tracker_ignored_group != null:
357 tracker_ignored_group.visible = true
358
359
360func _cmp_tracker_objects(a, b) -> bool:
361 if a["ignored"] != b["ignored"]:
362 return !a["ignored"]
363 elif a["hint"] != b["hint"]:
364 return a["hint"]
365 else:
366 return a["name"] < b["name"]
367
349 368
350func update_locations_visibility(): 369func update_locations_visibility():
351 var ap = global.get_node("Archipelago") 370 var ap = global.get_node("Archipelago")
@@ -372,7 +391,7 @@ func _on_tracker_button_clicked():
372 ap.client.getLogicalPath(type_str, tracker_object.get("id", null)) 391 ap.client.getLogicalPath(type_str, tracker_object.get("id", null))
373 elif tracker_tree.get_edited_column() == 3: 392 elif tracker_tree.get_edited_column() == 3:
374 ap.toggle_ignored_location(tracker_object["id"]) 393 ap.toggle_ignored_location(tracker_object["id"])
375 else: 394 elif edited_item.get_parent() == tracker_ignored_group:
376 # This is the ignored locations group. 395 # This is the ignored locations group.
377 if ( 396 if (
378 tracker_object_by_ignored_index.has(edited_index) 397 tracker_object_by_ignored_index.has(edited_index)
@@ -485,4 +504,5 @@ func reset_tracker_tab():
485 tracker_goal_tree_item = null 504 tracker_goal_tree_item = null
486 tracker_object_by_index.clear() 505 tracker_object_by_index.clear()
487 tracker_object_by_ignored_index.clear() 506 tracker_object_by_ignored_index.clear()
507 tracker_ignored_group = null
488 tracker_tree.clear() 508 tracker_tree.clear()