summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/game.rs8
-rw-r--r--server/src/protocol.rs2
-rw-r--r--test-client/main.ts2
-rw-r--r--test-client/protocol.ts2
4 files changed, 7 insertions, 7 deletions
diff --git a/server/src/game.rs b/server/src/game.rs
index 16f40a6d..5cb155f1 100644
--- a/server/src/game.rs
+++ b/server/src/game.rs
@@ -61,6 +61,10 @@ impl Game {
pub fn prime_client(&self, id: PlayerID) -> Vec<PacketC> {
let mut out = Vec::new();
+ out.push(PacketC::Init {
+ id,
+ data: self.data.deref().to_owned(),
+ });
for (&id, player) in &self.players {
out.push(PacketC::AddPlayer {
id,
@@ -81,10 +85,6 @@ impl Game {
})
}
}
- out.push(PacketC::Joined {
- id,
- data: self.data.deref().to_owned(),
- });
out
}
diff --git a/server/src/protocol.rs b/server/src/protocol.rs
index 3a40059a..9e6717a3 100644
--- a/server/src/protocol.rs
+++ b/server/src/protocol.rs
@@ -20,7 +20,7 @@ pub enum PacketS {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case", tag = "type")]
pub enum PacketC {
- Joined {
+ Init {
data: Gamedata,
id: PlayerID,
},
diff --git a/test-client/main.ts b/test-client/main.ts
index 7b515752..e0cc9b3c 100644
--- a/test-client/main.ts
+++ b/test-client/main.ts
@@ -51,7 +51,7 @@ function send(p: PacketS) { ws.send(JSON.stringify(p)) }
function packet(p: PacketC) {
if (!["position", "set_active"].includes(p.type)) console.log(p);
switch (p.type) {
- case "joined":
+ case "init":
my_id = p.id
data = p.data
break;
diff --git a/test-client/protocol.ts b/test-client/protocol.ts
index 520709fb..96657db7 100644
--- a/test-client/protocol.ts
+++ b/test-client/protocol.ts
@@ -16,7 +16,7 @@ export type PacketS =
| { type: "collide", player: PlayerID, force: Vec2 } // Apply force to another player as a result of a collision
export type PacketC =
- { type: "joined", id: PlayerID, data: Gamedata } // You joined
+ { type: "init", id: PlayerID, data: Gamedata } // You joined
| { type: "add_player", id: PlayerID, name: string, hand?: [ItemID, ItemIndex] } // Somebody else joined (or was already in the game)
| { type: "remove_player", id: PlayerID } // Somebody left
| { type: "position", player: PlayerID, pos: Vec2, rot: number } // Update the position of a players (your own position is included here)