This commit is contained in:
griffi-gh 2023-02-14 04:52:11 +01:00
parent 539b6a1f91
commit 4a7c985ba1
3 changed files with 17 additions and 3 deletions

View file

@ -38,7 +38,9 @@ pub fn authenticate_players(
//Approve the user
server.0.send_message(*from, ServerToClientMessage::ServerHello {
init: InitData {}
init: InitData {
users: todo!()
}
}).map_err(log_error).ok();
}
}

View file

@ -1,3 +1,5 @@
use std::num::NonZeroUsize;
use bincode::{Encode, Decode};
use crate::chunk::BlockData;
@ -24,8 +26,17 @@ pub enum ClientToServerMessage {
}
#[derive(Encode, Decode, Clone)]
pub struct InitData {
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<UserInitData>
}
#[derive(Encode, Decode, Clone)]

View file

@ -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::LittleEndian, bincode::config::Varint, bincode::config::SkipFixedArrayLength> = bincode::config::standard()