From 7544b11c86fd597321a507747fbd0fe1491ccbd8 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 22 Oct 2025 21:58:43 -0400 Subject: Implemented latched doors in the client --- apworld/client/client.gd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'apworld/client/client.gd') diff --git a/apworld/client/client.gd b/apworld/client/client.gd index 9a4b402..ce5ac7e 100644 --- a/apworld/client/client.gd +++ b/apworld/client/client.gd @@ -25,6 +25,7 @@ var _slot_data = {} var _accessible_locations = [] var _accessible_worldports = [] var _goal_accessible = false +var _latched_doors = [] signal could_not_connect signal connect_status @@ -34,6 +35,7 @@ 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 door_latched(id) signal accessible_locations_updated signal checked_locations_updated signal checked_worldports_updated @@ -189,6 +191,14 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo message["type"], int(message.get("id", null)), message["path"] ) + elif cmd == "UpdateLatches": + for id in message["latches"]: + var iid = int(id) + if not _latched_doors.has(iid): + _latched_doors.append(iid) + + door_latched.emit(iid) + func connectToServer(server, un, pw): sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}]) @@ -255,6 +265,13 @@ func checkWorldport(port_id): sendMessage([{"cmd": "CheckWorldport", "port_id": port_id}]) +func latchDoor(id): + if not _latched_doors.has(id): + _latched_doors.append(id) + + sendMessage([{"cmd": "LatchDoor", "door": id}]) + + func getLogicalPath(object_type, object_id): var msg = {"cmd": "GetPath", "type": object_type} if object_id != null: -- cgit 1.4.1