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.gd25
1 files changed, 12 insertions, 13 deletions
diff --git a/apworld/client/client.gd b/apworld/client/client.gd index 286ad4b..3d4096f 100644 --- a/apworld/client/client.gd +++ b/apworld/client/client.gd
@@ -33,6 +33,7 @@ signal item_sent_notification(message)
33signal hint_received(message) 33signal hint_received(message)
34signal accessible_locations_updated 34signal accessible_locations_updated
35signal checked_locations_updated 35signal checked_locations_updated
36signal keyboard_update_received
36 37
37 38
38func _init(): 39func _init():
@@ -157,6 +158,13 @@ func _on_web_socket_server_message_received(_peer_id: int, packet: String) -> vo
157 158
158 accessible_locations_updated.emit() 159 accessible_locations_updated.emit()
159 160
161 elif cmd == "UpdateKeyboard":
162 var updates = {}
163 for k in message["updates"]:
164 updates[k] = int(message["updates"][k])
165
166 keyboard_update_received.emit(updates)
167
160 168
161func connectToServer(server, un, pw): 169func connectToServer(server, un, pw):
162 sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}]) 170 sendMessage([{"cmd": "Connect", "server": server, "player": un, "password": pw}])
@@ -202,19 +210,6 @@ func sendLocations(loc_ids):
202 sendMessage([{"cmd": "LocationChecks", "locations": loc_ids}]) 210 sendMessage([{"cmd": "LocationChecks", "locations": loc_ids}])
203 211
204 212
205func setValue(key, value, operation = "replace"):
206 sendMessage(
207 [
208 {
209 "cmd": "Set",
210 "key": "Lingo2_%d_%s" % [_slot, key],
211 "want_reply": false,
212 "operations": [{"operation": operation, "value": value}]
213 }
214 ]
215 )
216
217
218func say(textdata): 213func say(textdata):
219 sendMessage([{"cmd": "Say", "text": textdata}]) 214 sendMessage([{"cmd": "Say", "text": textdata}])
220 215
@@ -227,6 +222,10 @@ func scoutLocations(loc_ids):
227 sendMessage([{"cmd": "LocationScouts", "locations": loc_ids}]) 222 sendMessage([{"cmd": "LocationScouts", "locations": loc_ids}])
228 223
229 224
225func updateKeyboard(updates):
226 sendMessage([{"cmd": "UpdateKeyboard", "keyboard": updates}])
227
228
230func sendQuit(): 229func sendQuit():
231 sendMessage([{"cmd": "Quit"}]) 230 sendMessage([{"cmd": "Quit"}])
232 231