mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-21 14:28: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",
|
"kubi-shared",
|
||||||
"log",
|
"log",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
|
"postcard",
|
||||||
|
"rand",
|
||||||
"rayon",
|
"rayon",
|
||||||
"serde",
|
"serde",
|
||||||
"shipyard",
|
"shipyard",
|
||||||
"toml",
|
"toml",
|
||||||
|
"uflow",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -9,7 +9,7 @@ kubi-shared = { path = "../kubi-shared" }
|
||||||
kubi-logging = { path = "../kubi-logging" }
|
kubi-logging = { path = "../kubi-logging" }
|
||||||
log = "*"
|
log = "*"
|
||||||
shipyard = { git = "https://github.com/leudz/shipyard", rev = "eb189f66" }
|
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"
|
toml = "0.7"
|
||||||
glam = { version = "0.23", features = ["debug-glam-assert", "fast-math"] }
|
glam = { version = "0.23", features = ["debug-glam-assert", "fast-math"] }
|
||||||
hashbrown = "0.13"
|
hashbrown = "0.13"
|
||||||
|
@ -17,7 +17,10 @@ nohash-hasher = "0.2.0"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
rayon = "1.6"
|
rayon = "1.6"
|
||||||
flume = "0.10"
|
flume = "0.10"
|
||||||
|
rand = "0.8"
|
||||||
|
uflow = "0.7"
|
||||||
|
postcard = { version = "1.0", features = ["alloc"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
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 shipyard::{Component, EntityId};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use nohash_hasher::BuildNoHashHasher;
|
use nohash_hasher::BuildNoHashHasher;
|
||||||
|
use kubi_shared::networking::client::ClientId;
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct Client(ClientId);
|
pub struct Client(ClientId);
|
||||||
|
|
||||||
pub struct ClientMap(HashMap<ClientId, EntityId, BuildNoHashHasher<ClientIdRepr>>);
|
pub struct ClientMap(HashMap<ClientId, EntityId, BuildNoHashHasher<ClientId>>);
|
||||||
impl ClientMap {
|
impl ClientMap {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self(HashMap::with_hasher(BuildNoHashHasher::default()))
|
Self(HashMap::with_hasher(BuildNoHashHasher::default()))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use shipyard::{AllStoragesView, Unique, UniqueView, UniqueViewMut};
|
use shipyard::{AllStoragesView, Unique, UniqueView, UniqueViewMut};
|
||||||
use kubi_shared::networking::messages::{ClientToServerMessage, ServerToClientMessage};
|
use kubi_shared::networking::messages::{ClientToServerMessage, ServerToClientMessage};
|
||||||
|
use uflow::server::Server;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use crate::config::ConfigTable;
|
use crate::config::ConfigTable;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
use glam::IVec3;
|
use glam::IVec3;
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use nohash_hasher::BuildNoHashHasher;
|
use nohash_hasher::BuildNoHashHasher;
|
||||||
use kubi_shared::chunk::BlockData;
|
use kubi_shared::{
|
||||||
|
chunk::BlockData,
|
||||||
|
networking::client::ClientId
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum ChunkState {
|
pub enum ChunkState {
|
||||||
|
@ -14,7 +17,7 @@ pub struct Chunk {
|
||||||
pub position: IVec3,
|
pub position: IVec3,
|
||||||
pub state: ChunkState,
|
pub state: ChunkState,
|
||||||
pub blocks: Option<BlockData>,
|
pub blocks: Option<BlockData>,
|
||||||
pub subscriptions: HashSet<ClientId, BuildNoHashHasher<ClientIdRepr>>,
|
pub subscriptions: HashSet<ClientId, BuildNoHashHasher<ClientId>>,
|
||||||
}
|
}
|
||||||
impl Chunk {
|
impl Chunk {
|
||||||
pub fn new(position: IVec3) -> Self {
|
pub fn new(position: IVec3) -> Self {
|
||||||
|
|
|
@ -19,4 +19,4 @@ rand_xoshiro = "0.6"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
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 messages;
|
||||||
pub mod state;
|
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