aboutsummaryrefslogtreecommitdiff
path: root/webAO/packets/handlers
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2023-11-22 20:58:28 +0100
committerDavid Skoland <davidskoland@gmail.com>2023-11-22 21:02:34 +0100
commit060409093da1d3392c0e165b043401baa3fb5d6b (patch)
tree1f02b80d60cecc06a657c3c26bfd8145986d1d80 /webAO/packets/handlers
parent26e3cd4bfe08a78e65935cf494c24193f59c8a7e (diff)
Add client state
It's very useful to know the state of client, whether it's connected or properly joined.
Diffstat (limited to 'webAO/packets/handlers')
-rw-r--r--webAO/packets/handlers/handleDONE.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/webAO/packets/handlers/handleDONE.ts b/webAO/packets/handlers/handleDONE.ts
index 6ca31bf..e323986 100644
--- a/webAO/packets/handlers/handleDONE.ts
+++ b/webAO/packets/handlers/handleDONE.ts
@@ -1,4 +1,5 @@
import queryParser from "../../utils/queryParser";
+import { client, clientState } from "../../client";
const { mode } = queryParser()
/**
@@ -8,9 +9,11 @@ const { mode } = queryParser()
* @param {Array} args packet arguments
*/
export const handleDONE = (_args: string[]) => {
- document.getElementById("client_loading")!.style.display = "none";
- if (mode === "watch") {
- // Spectators don't need to pick a character
- document.getElementById("client_waiting")!.style.display = "none";
- }
-} \ No newline at end of file
+ // DONE packet signals that the handshake is complete
+ client.state = clientState.Joined;
+ document.getElementById("client_loading")!.style.display = "none";
+ if (mode === "watch") {
+ // Spectators don't need to pick a character
+ document.getElementById("client_waiting")!.style.display = "none";
+ }
+}