This commit is contained in:
griffi-gh 2023-02-14 04:52:11 +01:00
parent 4440b07bbe
commit 740fa04910
3 changed files with 17 additions and 3 deletions

View file

@ -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();
}
}

View file

@ -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<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()