diff --git a/kubi-server/src/auth.rs b/kubi-server/src/auth.rs index eb2b634..5a376a0 100644 --- a/kubi-server/src/auth.rs +++ b/kubi-server/src/auth.rs @@ -35,10 +35,12 @@ pub fn authenticate_players( //Spawn the user // TODO - + //Approve the user server.0.send_message(*from, ServerToClientMessage::ServerHello { - init: InitData {} + init: InitData { + users: todo!() + } }).map_err(log_error).ok(); } } diff --git a/kubi-shared/src/networking/messages.rs b/kubi-shared/src/networking/messages.rs index 95b7b16..0b553c6 100644 --- a/kubi-shared/src/networking/messages.rs +++ b/kubi-shared/src/networking/messages.rs @@ -1,3 +1,5 @@ +use std::num::NonZeroUsize; + use bincode::{Encode, Decode}; use crate::chunk::BlockData; @@ -23,9 +25,18 @@ pub enum ClientToServerMessage { }, } +#[derive(Encode, Decode, Clone)] +pub struct UserInitData { + pub client_id: NonZeroUsize, //maybe use the proper type instead + pub username: String, + pub position: Vec3Arr, + pub velocity: Vec3Arr, + pub direction: QuatArr, +} + #[derive(Encode, Decode, Clone)] pub struct InitData { - + pub users: Vec } #[derive(Encode, Decode, Clone)] diff --git a/kubi-udp/src/lib.rs b/kubi-udp/src/lib.rs index ae5678c..82588e3 100644 --- a/kubi-udp/src/lib.rs +++ b/kubi-udp/src/lib.rs @@ -4,6 +4,7 @@ pub(crate) mod packet; pub(crate) mod common; pub use common::ClientId; pub use common::ClientIdRepr; +pub use common::MAX_CLIENTS; //pub(crate) trait Serializable: bincode::Encode + bincode::Decode {} pub(crate) const BINCODE_CONFIG: bincode::config::Configuration = bincode::config::standard()