From 41c180e66a27298d7826fbe3b5d1a8f90fba53fb Mon Sep 17 00:00:00 2001 From: core Date: Thu, 13 Apr 2023 21:55:12 -0400 Subject: [PATCH] work on switching to protobuf for the protocol --- Cargo.lock | 336 ++++++++++++++++++++++++++-- protocol/Cargo.toml | 7 +- protocol/build.rs | 13 ++ protocol/src/legacy.rs | 103 +++++++++ protocol/src/lib.rs | 104 +-------- protocol/src/pbuf/message_c2s.proto | 6 +- protocol/src/pbuf/message_s2c.proto | 8 +- protocol/src/pbuf/state.proto | 2 - 8 files changed, 448 insertions(+), 131 deletions(-) create mode 100644 protocol/build.rs create mode 100644 protocol/src/legacy.rs diff --git a/Cargo.lock b/Cargo.lock index 3fdd5884b710bd5e9ad2752857062679549159e4..bc8c6b831e8a8251b692236f131828c366e924cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,21 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" + [[package]] name = "approx" version = "0.5.1" @@ -168,6 +183,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + [[package]] name = "cfg-if" version = "1.0.0" @@ -335,6 +356,27 @@ version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "exr" version = "1.6.3" @@ -351,6 +393,15 @@ dependencies = [ "zune-inflate", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fdeflate" version = "0.3.0" @@ -572,6 +623,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "http" version = "0.2.9" @@ -669,6 +726,26 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "itoa" version = "1.0.6" @@ -717,6 +794,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +[[package]] +name = "linux-raw-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" + [[package]] name = "lock_api" version = "0.4.9" @@ -1021,6 +1104,94 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "protobuf" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + +[[package]] +name = "protobuf" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror", +] + +[[package]] +name = "protobuf-codegen" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "033460afb75cf755fcfc16dfaed20b86468082a2ea24e05ac35ab4a099a017d6" +dependencies = [ + "protobuf 2.28.0", +] + +[[package]] +name = "protobuf-codegen" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd418ac3c91caa4032d37cb80ff0d44e2ebe637b2fb243b6234bf89cdac4901" +dependencies = [ + "anyhow", + "once_cell", + "protobuf 3.2.0", + "protobuf-parse", + "regex", + "tempfile", + "thiserror", +] + +[[package]] +name = "protobuf-parse" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d39b14605eaa1f6a340aec7f320b34064feb26c93aec35d6a9a2272a8ddfa49" +dependencies = [ + "anyhow", + "indexmap", + "log", + "protobuf 3.2.0", + "protobuf-support", + "tempfile", + "thiserror", + "which", +] + +[[package]] +name = "protobuf-support" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372" +dependencies = [ + "thiserror", +] + +[[package]] +name = "protoc" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0218039c514f9e14a5060742ecd50427f8ac4f85a6dc58f2ddb806e318c55ee" +dependencies = [ + "log", + "which", +] + +[[package]] +name = "protoc-rust" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f8a182bb17c485f20bdc4274a8c39000a61024cfe461c799b50fec77267838" +dependencies = [ + "protobuf 2.28.0", + "protobuf-codegen 2.28.0", + "protoc", + "tempfile", +] + [[package]] name = "qoi" version = "0.4.1" @@ -1118,6 +1289,32 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "rmp" version = "0.8.11" @@ -1172,6 +1369,20 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.37.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + [[package]] name = "ryu" version = "1.0.13" @@ -1358,8 +1569,9 @@ dependencies = [ name = "starkingdoms-protocol" version = "0.1.0" dependencies = [ - "rmp-serde", - "serde", + "protobuf 3.2.0", + "protobuf-codegen 3.2.0", + "protoc-rust", ] [[package]] @@ -1405,6 +1617,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tempfile" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.45.0", +] + [[package]] name = "thiserror" version = "1.0.40" @@ -1745,6 +1970,17 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +[[package]] +name = "which" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +dependencies = [ + "either", + "libc", + "once_cell", +] + [[package]] name = "wide" version = "0.7.8" @@ -1783,13 +2019,13 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -1798,7 +2034,16 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", ] [[package]] @@ -1807,13 +2052,28 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -1822,42 +2082,84 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + [[package]] name = "ws_stream_wasm" version = "0.7.4" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index d4e718fa7604c830eefa4044a93d985c53720d2e..1f220ff6c59130001006e0360f707d03de54d4b3 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -6,5 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde = { version = "1", features = ["derive"] } -rmp-serde = "1.1" \ No newline at end of file +protobuf = "3" + +[build-dependencies] +protobuf-codegen = "3" +protoc-rust = "^2.0" \ No newline at end of file diff --git a/protocol/build.rs b/protocol/build.rs new file mode 100644 index 0000000000000000000000000000000000000000..c4c9bcd3b4d587db2c243e6c5e5722093fe579f9 --- /dev/null +++ b/protocol/build.rs @@ -0,0 +1,13 @@ +fn main() { + protobuf_codegen::Codegen::new() + .cargo_out_dir("protos") + .include("src/pbuf") + .input("src/pbuf/starkingdoms-protocol.proto") + .input("src/pbuf/message_c2s.proto") + .input("src/pbuf/message_s2c.proto") + .input("src/pbuf/planet.proto") + .input("src/pbuf/player.proto") + .input("src/pbuf/state.proto") + .input("src/pbuf/goodbye_reason.proto") + .run_from_script(); +} \ No newline at end of file diff --git a/protocol/src/legacy.rs b/protocol/src/legacy.rs new file mode 100644 index 0000000000000000000000000000000000000000..dc181b3cfe29eafdc982c425e9b8e66fff28251a --- /dev/null +++ b/protocol/src/legacy.rs @@ -0,0 +1,103 @@ +use serde::{Deserialize, Serialize}; + +pub const PROTOCOL_VERSION: u32 = 1; + +#[derive(Serialize, Deserialize, Debug, Clone, Copy)] +pub enum State { + Handshake, + Play +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub enum MessageC2S { + Hello { + version: u32, + requested_username: String, + next_state: State + }, + + Goodbye { + reason: GoodbyeReason + }, + + Chat { + message: String + }, + + Ping {}, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub enum MessageS2C { + Hello { + version: u32, + given_username: String, + next_state: State + }, + + Goodbye { + reason: GoodbyeReason + }, + + Chat { + from: String, + message: String + }, + + Pong {}, + + PlayersUpdate { + players: Vec + }, + + + PlanetData { + planets: Vec + } +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct ProtocolPlayer { + pub rotation: f64, + pub x: f64, + pub y: f64, + pub username: String +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub enum GoodbyeReason { + UnsupportedProtocol { supported: u32, got: u32 }, + UnexpectedPacket, + UnexpectedNextState, + UsernameTaken, + PingPongTimeout, + Done, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct ProtocolPlanet { + pub planet_type: PlanetType, + pub x: f64, + pub y: f64, + pub radius: f64 +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub enum PlanetType { + Earth +} + +impl PlanetType { + pub fn as_texture_id(&self) -> String { + match self { + PlanetType::Earth => "earth".to_string() + } + } +} + +pub fn pc2s(pkt: &MessageC2S) -> Vec { + rmp_serde::to_vec(pkt).unwrap() +} +pub fn ps2c(pkt: &MessageS2C) -> Vec { + rmp_serde::to_vec(pkt).unwrap() +} diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index dc181b3cfe29eafdc982c425e9b8e66fff28251a..c001c58fbb1d528246c49c1b5c1cea5ae5f84992 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,103 +1 @@ -use serde::{Deserialize, Serialize}; - -pub const PROTOCOL_VERSION: u32 = 1; - -#[derive(Serialize, Deserialize, Debug, Clone, Copy)] -pub enum State { - Handshake, - Play -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum MessageC2S { - Hello { - version: u32, - requested_username: String, - next_state: State - }, - - Goodbye { - reason: GoodbyeReason - }, - - Chat { - message: String - }, - - Ping {}, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum MessageS2C { - Hello { - version: u32, - given_username: String, - next_state: State - }, - - Goodbye { - reason: GoodbyeReason - }, - - Chat { - from: String, - message: String - }, - - Pong {}, - - PlayersUpdate { - players: Vec - }, - - - PlanetData { - planets: Vec - } -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct ProtocolPlayer { - pub rotation: f64, - pub x: f64, - pub y: f64, - pub username: String -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum GoodbyeReason { - UnsupportedProtocol { supported: u32, got: u32 }, - UnexpectedPacket, - UnexpectedNextState, - UsernameTaken, - PingPongTimeout, - Done, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct ProtocolPlanet { - pub planet_type: PlanetType, - pub x: f64, - pub y: f64, - pub radius: f64 -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub enum PlanetType { - Earth -} - -impl PlanetType { - pub fn as_texture_id(&self) -> String { - match self { - PlanetType::Earth => "earth".to_string() - } - } -} - -pub fn pc2s(pkt: &MessageC2S) -> Vec { - rmp_serde::to_vec(pkt).unwrap() -} -pub fn ps2c(pkt: &MessageS2C) -> Vec { - rmp_serde::to_vec(pkt).unwrap() -} +include!(concat!(env!("OUT_DIR"), "/protos/mod.rs")); \ No newline at end of file diff --git a/protocol/src/pbuf/message_c2s.proto b/protocol/src/pbuf/message_c2s.proto index ee8f4d078bd4b69ff92ff280b5e0b5291ff9335d..3c601f06112784bcb08abf06ae99d1cee6f03ab8 100644 --- a/protocol/src/pbuf/message_c2s.proto +++ b/protocol/src/pbuf/message_c2s.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package protocol.messagec2s; +package protocol.message_c2s; import "state.proto"; import "goodbye_reason.proto"; @@ -9,13 +9,13 @@ message MessageC2SHello { uint32 version = 1; // Version of the protocol. Currently always 1 string requested_username = 2; // The username that the client is requesting. - State next_state = 3; // The state the connection will go into after the handshake. + protocol.state.State next_state = 3; // The state the connection will go into after the handshake. } message MessageC2SGoodbye { enum packet_info { unknown = 0; type = 0x02; } - GoodbyeReason reason = 1; // The reason the client is disconnecting the server + protocol.goodbye_reason.GoodbyeReason reason = 1; // The reason the client is disconnecting the server } message MessageC2SChat { diff --git a/protocol/src/pbuf/message_s2c.proto b/protocol/src/pbuf/message_s2c.proto index ff90fa0e15706549684819f7a34132ddadb68b50..08c6e31aa3dd3e10c2ebbd7822eabdb6f0dafcdc 100644 --- a/protocol/src/pbuf/message_s2c.proto +++ b/protocol/src/pbuf/message_s2c.proto @@ -11,13 +11,13 @@ message MessageS2CHello { uint32 version = 1; // The version of the protocol in use. Currently always 1. string given_username = 2; // The username actually assigned to the player - State next_state = 3; // The state to switch the game into + protocol.state.State next_state = 3; // The state to switch the game into } message MessageS2CGoodbye { enum packet_info { unknown = 0; type = 0x06; } - GoodbyeReason reason = 1; // The reason for the disconnect + protocol.goodbye_reason.GoodbyeReason reason = 1; // The reason for the disconnect } message MessageS2CChat { @@ -34,11 +34,11 @@ message MessageS2CPong { message MessageS2CPlayersUpdate { enum packet_info { unknown = 0; type = 0x09; } - repeated Player players = 1; // List of all players in the server + repeated protocol.player.Player players = 1; // List of all players in the server } message MessageS2CPlanetData { enum packet_info { unknown = 0; type = 0x0a; } - repeated Planet planets = 1; // List of all planets on the server + repeated protocol.planet.Planet planets = 1; // List of all planets on the server } \ No newline at end of file diff --git a/protocol/src/pbuf/state.proto b/protocol/src/pbuf/state.proto index fb8b36f9cb5b69a7b9bbba07e5da15e680ce9079..a9b2e6d0061b0bb113d14f00287cbc95cb65ef79 100644 --- a/protocol/src/pbuf/state.proto +++ b/protocol/src/pbuf/state.proto @@ -1,8 +1,6 @@ syntax = "proto3"; package protocol.state; -import "state.proto"; - enum State { Handshake = 0; Play = 1;