From b524e153ad71e368afbe50da78c4b73c3ac65c5f Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 27 Sep 2025 11:10:07 -0400 Subject: Added accessible locations tab to game --- apworld/client/client.gd | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'apworld/client/client.gd') diff --git a/apworld/client/client.gd b/apworld/client/client.gd index 67edf29..05b2b6c 100644 --- a/apworld/client/client.gd +++ b/apworld/client/client.gd @@ -21,6 +21,7 @@ var _checked_locations = [] var _received_indexes = [] var _received_items = {} var _slot_data = {} +var _accessible_locations = [] signal could_not_connect signal connect_status @@ -30,6 +31,8 @@ signal location_scout_received(location_id, item_name, player_name, flags, for_s signal text_message_received(message) signal item_sent_notification(message) signal hint_received(message) +signal accessible_locations_updated +signal checked_locations_updated func _init(): @@ -51,6 +54,7 @@ func _reset_state(): _should_process = false _received_items = {} _received_indexes = [] + _accessible_locations = [] func disconnect_from_ap(): @@ -92,15 +96,26 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo _gen_version = message["generator_version"] _team = message["team"] _slot = message["slot"] - _checked_locations = message["checked_locations"] _slot_data = message["slot_data"] + _checked_locations = [] + for location in message["checked_locations"]: + _checked_locations.append(int(message["checked_locations"])) + client_connected.emit(_slot_data) elif cmd == "ConnectionRefused": could_not_connect.emit(message["text"]) global._print("Connection to AP refused") + elif cmd == "UpdateLocations": + for location in message["locations"]: + var lint = int(location) + if not _checked_locations.has(lint): + _checked_locations.append(lint) + + checked_locations_updated.emit() + elif cmd == "ItemReceived": for item in message["items"]: var index = int(item["index"]) @@ -134,6 +149,14 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo int(loc["for_self"]) ) + elif cmd == "AccessibleLocations": + _accessible_locations.clear() + + for loc in message["locations"]: + _accessible_locations.append(int(loc)) + + accessible_locations_updated.emit() + func connectToServer(server, un, pw): sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}]) -- cgit 1.4.1