mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-24 15:58:43 -06:00
change server stuff
This commit is contained in:
parent
765e360d44
commit
34a50c62b0
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -961,10 +961,13 @@ dependencies = [
|
|||
"kubi-shared",
|
||||
"log",
|
||||
"nohash-hasher",
|
||||
"postcard",
|
||||
"rand",
|
||||
"rayon",
|
||||
"serde",
|
||||
"shipyard",
|
||||
"toml",
|
||||
"uflow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -9,7 +9,7 @@ kubi-shared = { path = "../kubi-shared" }
|
|||
kubi-logging = { path = "../kubi-logging" }
|
||||
log = "*"
|
||||
shipyard = { git = "https://github.com/leudz/shipyard", rev = "eb189f66" }
|
||||
serde = "1.0"
|
||||
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
|
||||
toml = "0.7"
|
||||
glam = { version = "0.23", features = ["debug-glam-assert", "fast-math"] }
|
||||
hashbrown = "0.13"
|
||||
|
@ -17,7 +17,10 @@ nohash-hasher = "0.2.0"
|
|||
anyhow = "1.0"
|
||||
rayon = "1.6"
|
||||
flume = "0.10"
|
||||
rand = "0.8"
|
||||
uflow = "0.7"
|
||||
postcard = { version = "1.0", features = ["alloc"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
unstable = ["glam/core-simd"]
|
||||
nightly = ["rand/nightly", "rand/simd_support", "serde/unstable", "glam/core-simd", "kubi-shared/nightly"]
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use shipyard::{Component, EntityId};
|
||||
use hashbrown::HashMap;
|
||||
use nohash_hasher::BuildNoHashHasher;
|
||||
use kubi_shared::networking::client::ClientId;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Client(ClientId);
|
||||
|
||||
pub struct ClientMap(HashMap<ClientId, EntityId, BuildNoHashHasher<ClientIdRepr>>);
|
||||
pub struct ClientMap(HashMap<ClientId, EntityId, BuildNoHashHasher<ClientId>>);
|
||||
impl ClientMap {
|
||||
pub fn new() -> Self {
|
||||
Self(HashMap::with_hasher(BuildNoHashHasher::default()))
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use shipyard::{AllStoragesView, Unique, UniqueView, UniqueViewMut};
|
||||
use kubi_shared::networking::messages::{ClientToServerMessage, ServerToClientMessage};
|
||||
use uflow::server::Server;
|
||||
use std::time::Duration;
|
||||
use crate::config::ConfigTable;
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
use glam::IVec3;
|
||||
use hashbrown::HashSet;
|
||||
use nohash_hasher::BuildNoHashHasher;
|
||||
use kubi_shared::chunk::BlockData;
|
||||
use kubi_shared::{
|
||||
chunk::BlockData,
|
||||
networking::client::ClientId
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum ChunkState {
|
||||
|
@ -14,7 +17,7 @@ pub struct Chunk {
|
|||
pub position: IVec3,
|
||||
pub state: ChunkState,
|
||||
pub blocks: Option<BlockData>,
|
||||
pub subscriptions: HashSet<ClientId, BuildNoHashHasher<ClientIdRepr>>,
|
||||
pub subscriptions: HashSet<ClientId, BuildNoHashHasher<ClientId>>,
|
||||
}
|
||||
impl Chunk {
|
||||
pub fn new(position: IVec3) -> Self {
|
||||
|
|
|
@ -19,4 +19,4 @@ rand_xoshiro = "0.6"
|
|||
|
||||
[features]
|
||||
default = []
|
||||
nightly = ["rand/nightly", "rand/simd_support", "serde/unstable"]
|
||||
nightly = ["rand/nightly", "rand/simd_support", "serde/unstable", "glam/core-simd"]
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
pub mod messages;
|
||||
pub mod state;
|
||||
pub mod client;
|
||||
|
|
3
kubi-shared/src/networking/client.rs
Normal file
3
kubi-shared/src/networking/client.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
pub type ClientId = u16;
|
||||
pub type ClientKey = u16;
|
||||
|
Loading…
Reference in a new issue