about summary refs log tree commit diff stats
path: root/apworld/client/client.gd
diff options
context:
space:
mode:
Diffstat (limited to 'apworld/client/client.gd')
-rw-r--r--apworld/client/client.gd17
1 files changed, 17 insertions, 0 deletions
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 = {}
25var _accessible_locations = [] 25var _accessible_locations = []
26var _accessible_worldports = [] 26var _accessible_worldports = []
27var _goal_accessible = false 27var _goal_accessible = false
28var _latched_doors = []
28 29
29signal could_not_connect 30signal could_not_connect
30signal connect_status 31signal connect_status
@@ -34,6 +35,7 @@ signal location_scout_received(location_id, item_name, player_name, flags, for_s
34signal text_message_received(message) 35signal text_message_received(message)
35signal item_sent_notification(message) 36signal item_sent_notification(message)
36signal hint_received(message) 37signal hint_received(message)
38signal door_latched(id)
37signal accessible_locations_updated 39signal accessible_locations_updated
38signal checked_locations_updated 40signal checked_locations_updated
39signal checked_worldports_updated 41signal checked_worldports_updated
@@ -189,6 +191,14 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo
189 message["type"], int(message.get("id", null)), message["path"] 191 message["type"], int(message.get("id", null)), message["path"]
190 ) 192 )
191 193
194 elif cmd == "UpdateLatches":
195 for id in message["latches"]:
196 var iid = int(id)
197 if not _latched_doors.has(iid):
198 _latched_doors.append(iid)
199
200 door_latched.emit(iid)
201
192 202
193func connectToServer(server, un, pw): 203func connectToServer(server, un, pw):
194 sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}]) 204 sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}])
@@ -255,6 +265,13 @@ func checkWorldport(port_id):
255 sendMessage([{"cmd": "CheckWorldport", "port_id": port_id}]) 265 sendMessage([{"cmd": "CheckWorldport", "port_id": port_id}])
256 266
257 267
268func latchDoor(id):
269 if not _latched_doors.has(id):
270 _latched_doors.append(id)
271
272 sendMessage([{"cmd": "LatchDoor", "door": id}])
273
274
258func getLogicalPath(object_type, object_id): 275func getLogicalPath(object_type, object_id):
259 var msg = {"cmd": "GetPath", "type": object_type} 276 var msg = {"cmd": "GetPath", "type": object_type}
260 if object_id != null: 277 if object_id != null: