From 53e0509fcb20cc824e3fe5b3d3a826f09fc9c166 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 27 Sep 2025 21:06:32 -0400 Subject: Treat worldports as items for tracker --- apworld/client/client.gd | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'apworld/client/client.gd') diff --git a/apworld/client/client.gd b/apworld/client/client.gd index 3d4096f..a23e85a 100644 --- a/apworld/client/client.gd +++ b/apworld/client/client.gd @@ -18,10 +18,12 @@ var _seed = "" var _team = 0 var _slot = 0 var _checked_locations = [] +var _checked_worldports = [] var _received_indexes = [] var _received_items = {} var _slot_data = {} var _accessible_locations = [] +var _accessible_worldports = [] signal could_not_connect signal connect_status @@ -33,6 +35,7 @@ signal item_sent_notification(message) signal hint_received(message) signal accessible_locations_updated signal checked_locations_updated +signal checked_worldports_updated signal keyboard_update_received @@ -55,7 +58,9 @@ func _reset_state(): _should_process = false _received_items = {} _received_indexes = [] + _checked_worldports = [] _accessible_locations = [] + _accessible_worldports = [] func disconnect_from_ap(): @@ -117,6 +122,14 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo checked_locations_updated.emit() + elif cmd == "UpdateWorldports": + for port_id in message["worldports"]: + var lint = int(port_id) + if not _checked_worldports.has(lint): + _checked_worldports.append(lint) + + checked_worldports_updated.emit() + elif cmd == "ItemReceived": for item in message["items"]: var index = int(item["index"]) @@ -152,10 +165,15 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo elif cmd == "AccessibleLocations": _accessible_locations.clear() + _accessible_worldports.clear() for loc in message["locations"]: _accessible_locations.append(int(loc)) + if "worldports" in message: + for port_id in message["worldports"]: + _accessible_worldports.append(int(port_id)) + accessible_locations_updated.emit() elif cmd == "UpdateKeyboard": @@ -226,6 +244,11 @@ func updateKeyboard(updates): sendMessage([{"cmd": "UpdateKeyboard", "keyboard": updates}]) +func checkWorldport(port_id): + if not _checked_worldports.has(port_id): + sendMessage([{"cmd": "CheckWorldport", "port_id": port_id}]) + + func sendQuit(): sendMessage([{"cmd": "Quit"}]) -- cgit 1.4.1