mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'common-state' into 'master'
Common state See merge request veloren/veloren!2076
This commit is contained in:
commit
96b739a841
29
Cargo.lock
generated
29
Cargo.lock
generated
@ -5442,6 +5442,7 @@ dependencies = [
|
||||
"veloren-common-ecs",
|
||||
"veloren-common-frontend",
|
||||
"veloren-common-net",
|
||||
"veloren-common-state",
|
||||
"veloren-common-sys",
|
||||
"veloren-network",
|
||||
]
|
||||
@ -5523,7 +5524,6 @@ dependencies = [
|
||||
name = "veloren-common-net"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"authc",
|
||||
"hashbrown",
|
||||
"serde",
|
||||
"specs",
|
||||
@ -5535,18 +5535,14 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren-common-sys"
|
||||
name = "veloren-common-state"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"hashbrown",
|
||||
"indexmap",
|
||||
"ordered-float 2.1.1",
|
||||
"rand 0.8.3",
|
||||
"rayon",
|
||||
"scopeguard",
|
||||
"serde",
|
||||
"slab",
|
||||
"specs",
|
||||
"tar",
|
||||
"toml",
|
||||
@ -5560,6 +5556,25 @@ dependencies = [
|
||||
"wasmer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren-common-sys"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"indexmap",
|
||||
"ordered-float 2.1.1",
|
||||
"rand 0.8.3",
|
||||
"rayon",
|
||||
"slab",
|
||||
"specs",
|
||||
"tracing",
|
||||
"vek",
|
||||
"veloren-common",
|
||||
"veloren-common-base",
|
||||
"veloren-common-ecs",
|
||||
"veloren-common-net",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "veloren-network"
|
||||
version = "0.3.0"
|
||||
@ -5666,6 +5681,7 @@ dependencies = [
|
||||
"veloren-common-base",
|
||||
"veloren-common-ecs",
|
||||
"veloren-common-net",
|
||||
"veloren-common-state",
|
||||
"veloren-common-sys",
|
||||
"veloren-network",
|
||||
"veloren-plugin-api",
|
||||
@ -5753,6 +5769,7 @@ dependencies = [
|
||||
"veloren-common-ecs",
|
||||
"veloren-common-frontend",
|
||||
"veloren-common-net",
|
||||
"veloren-common-state",
|
||||
"veloren-common-sys",
|
||||
"veloren-server",
|
||||
"veloren-voxygen-anim",
|
||||
|
@ -6,6 +6,7 @@ members = [
|
||||
"common/base",
|
||||
"common/ecs",
|
||||
"common/net",
|
||||
"common/state",
|
||||
"common/sys",
|
||||
"common/frontend",
|
||||
"client",
|
||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
||||
[features]
|
||||
tracy = ["common/tracy", "common-base/tracy", "common-sys/tracy", "common-net/tracy", "common-frontend/tracy"]
|
||||
simd = ["vek/platform_intrinsics"]
|
||||
plugins = ["common-sys/plugins"]
|
||||
plugins = ["common-state/plugins"]
|
||||
bin_bot = ["common-ecs", "serde", "ron", "clap", "rustyline", "common-frontend", "async-channel"]
|
||||
|
||||
default = ["simd"]
|
||||
@ -15,6 +15,7 @@ default = ["simd"]
|
||||
[dependencies]
|
||||
common = { package = "veloren-common", path = "../common", features = ["no-assets"] }
|
||||
common-base = { package = "veloren-common-base", path = "../common/base" }
|
||||
common-state = { package = "veloren-common-state", path = "../common/state", default-features = false }
|
||||
common-sys = { package = "veloren-common-sys", path = "../common/sys", default-features = false }
|
||||
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||
network = { package = "veloren-network", path = "../network", features = ["compression"], default-features = false }
|
||||
|
@ -54,7 +54,8 @@ use common_net::{
|
||||
},
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use common_sys::add_local_systems;
|
||||
use comp::BuffKind;
|
||||
use futures_util::FutureExt;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
@ -1418,7 +1419,14 @@ impl Client {
|
||||
}
|
||||
|
||||
// 4) Tick the client's LocalState
|
||||
self.state.tick(dt, add_foreign_systems, true);
|
||||
self.state.tick(
|
||||
dt,
|
||||
|dispatch_builder| {
|
||||
add_local_systems(dispatch_builder);
|
||||
add_foreign_systems(dispatch_builder);
|
||||
},
|
||||
true,
|
||||
);
|
||||
// TODO: avoid emitting these in the first place
|
||||
self.state
|
||||
.ecs()
|
||||
|
@ -30,6 +30,17 @@ pub enum Origin {
|
||||
Frontend(&'static str),
|
||||
}
|
||||
|
||||
impl Origin {
|
||||
fn name(&self) -> &'static str {
|
||||
match self {
|
||||
Origin::Common => "Common",
|
||||
Origin::Client => "Client",
|
||||
Origin::Server => "Server",
|
||||
Origin::Frontend(name) => name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct CpuTimeline {
|
||||
/// measurements for a System
|
||||
@ -234,7 +245,7 @@ pub trait System<'a> {
|
||||
|
||||
type SystemData: specs::SystemData<'a>;
|
||||
fn run(job: &mut Job<Self>, data: Self::SystemData);
|
||||
fn sys_name() -> String { format!("{}_sys", Self::NAME) }
|
||||
fn sys_name() -> String { format!("{}_{}_sys", Self::ORIGIN.name(), Self::NAME) }
|
||||
}
|
||||
|
||||
pub fn dispatch<'a, 'b, T>(builder: &mut specs::DispatcherBuilder<'a, 'b>, dep: &[&str])
|
||||
|
@ -21,9 +21,6 @@ tracing = { version = "0.1", default-features = false }
|
||||
# Data structures
|
||||
hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] }
|
||||
|
||||
# Auth
|
||||
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253f8f2f92760ef44d2679c9a" }
|
||||
|
||||
# ECS
|
||||
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control"], rev = "5a9b71035007be0e3574f35184acac1cd4530496" }
|
||||
specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "b65fb220e94f5d3c9bc30074a076149763795556" }
|
||||
|
@ -1,6 +1,5 @@
|
||||
use super::{world_msg::EconomyInfo, ClientType, EcsCompPacket, PingMsg};
|
||||
use crate::sync;
|
||||
use authc::AuthClientError;
|
||||
use common::{
|
||||
character::{self, CharacterItem},
|
||||
comp::{self, invite::InviteKind, item::MaterialStatManifest},
|
||||
@ -259,10 +258,6 @@ impl ServerMsg {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AuthClientError> for RegisterError {
|
||||
fn from(err: AuthClientError) -> Self { Self::AuthError(err.to_string()) }
|
||||
}
|
||||
|
||||
impl From<comp::ChatMsg> for ServerGeneral {
|
||||
fn from(v: comp::ChatMsg) -> Self { ServerGeneral::ChatMsg(v) }
|
||||
}
|
||||
|
40
common/state/Cargo.toml
Normal file
40
common/state/Cargo.toml
Normal file
@ -0,0 +1,40 @@
|
||||
[package]
|
||||
authors = ["Marcel Märtens <marcel.cochem@googlemail.com>"]
|
||||
edition = "2018"
|
||||
name = "veloren-common-state"
|
||||
version = "0.9.0"
|
||||
|
||||
[features]
|
||||
tracy = ["common/tracy"]
|
||||
simd = ["vek/platform_intrinsics"]
|
||||
plugins = ["toml", "tar", "wasmer", "bincode", "plugin-api", "serde"]
|
||||
|
||||
default = ["simd"]
|
||||
|
||||
[dependencies]
|
||||
common = { package = "veloren-common", path = ".." }
|
||||
common-net = { package = "veloren-common-net", path = "../net" }
|
||||
common-ecs = { package = "veloren-common-ecs", path = "../ecs" }
|
||||
common-base = { package = "veloren-common-base", path = "../base" }
|
||||
|
||||
rayon = "1.5"
|
||||
tracing = { version = "0.1", default-features = false }
|
||||
vek = { version = "=0.14.1", features = ["serde"] }
|
||||
|
||||
# Data structures
|
||||
hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] }
|
||||
|
||||
# ECS
|
||||
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control", "derive"], rev = "5a9b71035007be0e3574f35184acac1cd4530496" }
|
||||
|
||||
# Plugins
|
||||
scopeguard = "1.1.0"
|
||||
serde = { version = "1.0.110", features = ["derive"], optional = true }
|
||||
toml = { version = "0.5.7", optional = true }
|
||||
tar = { version = "0.4.30", optional = true }
|
||||
wasmer = { version = "1.0.0", optional = true, default-features = false, features = ["wat", "default-cranelift", "default-jit"] }
|
||||
bincode = { version = "1.3.1", optional = true }
|
||||
plugin-api = { package = "veloren-plugin-api", path = "../../plugin/api", optional = true }
|
||||
|
||||
# Tweak running code
|
||||
#inline_tweak = { version = "1.0.8", features = ["release_tweak"] }
|
@ -1,3 +1,5 @@
|
||||
#[cfg(feature = "plugins")] pub mod plugin;
|
||||
|
||||
#[cfg(feature = "plugins")]
|
||||
use crate::plugin::memory_manager::EcsWorld;
|
||||
#[cfg(feature = "plugins")]
|
||||
@ -18,7 +20,7 @@ use common::{
|
||||
vol::{ReadVol, WriteVol},
|
||||
};
|
||||
use common_base::span;
|
||||
use common_ecs::{run_now, PhysicsMetrics, SysMetrics};
|
||||
use common_ecs::{PhysicsMetrics, SysMetrics};
|
||||
use common_net::sync::{interpolation as sync_interp, WorldSyncExt};
|
||||
use core::{convert::identity, time::Duration};
|
||||
use hashbrown::{hash_map, HashMap, HashSet};
|
||||
@ -506,7 +508,7 @@ impl State {
|
||||
pub fn tick(
|
||||
&mut self,
|
||||
dt: Duration,
|
||||
add_foreign_systems: impl Fn(&mut DispatcherBuilder),
|
||||
add_systems: impl Fn(&mut DispatcherBuilder),
|
||||
update_terrain_and_regions: bool,
|
||||
) {
|
||||
span!(_guard, "tick", "State::tick");
|
||||
@ -528,14 +530,12 @@ impl State {
|
||||
// Create and run a dispatcher for ecs systems.
|
||||
let mut dispatch_builder =
|
||||
DispatcherBuilder::new().with_pool(Arc::clone(&self.thread_pool));
|
||||
crate::add_local_systems(&mut dispatch_builder);
|
||||
// TODO: Consider alternative ways to do this
|
||||
add_foreign_systems(&mut dispatch_builder);
|
||||
add_systems(&mut dispatch_builder);
|
||||
// This dispatches all the systems in parallel.
|
||||
let mut dispatcher = dispatch_builder.build();
|
||||
drop(guard);
|
||||
span!(guard, "run systems");
|
||||
run_now::<crate::interpolation::InterpolationSystem>(&self.ecs);
|
||||
dispatcher.dispatch(&self.ecs);
|
||||
drop(guard);
|
||||
|
@ -7,7 +7,6 @@ version = "0.9.0"
|
||||
[features]
|
||||
tracy = ["common/tracy"]
|
||||
simd = ["vek/platform_intrinsics"]
|
||||
plugins = ["toml", "tar", "wasmer", "bincode", "plugin-api"]
|
||||
|
||||
default = ["simd"]
|
||||
|
||||
@ -31,16 +30,5 @@ slab = "0.4.2"
|
||||
# ECS
|
||||
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control", "derive"], rev = "5a9b71035007be0e3574f35184acac1cd4530496" }
|
||||
|
||||
# Serde
|
||||
serde = { version = "1.0.110", features = ["derive"] }
|
||||
|
||||
# Plugins
|
||||
scopeguard = "1.1.0"
|
||||
toml = { version = "0.5.7", optional = true }
|
||||
tar = { version = "0.4.30", optional = true }
|
||||
wasmer = { version = "1.0.0", optional = true, default-features = false, features = ["wat", "default-cranelift", "default-jit"] }
|
||||
bincode = { version = "1.3.1", optional = true }
|
||||
plugin-api = { package = "veloren-plugin-api", path = "../../plugin/api", optional = true }
|
||||
|
||||
# Tweak running code
|
||||
#inline_tweak = { version = "1.0.8", features = ["release_tweak"] }
|
||||
|
@ -11,35 +11,37 @@ use specs::{
|
||||
};
|
||||
|
||||
#[derive(SystemData)]
|
||||
pub struct InterpolationSystemData<'a> {
|
||||
pub struct ReadData<'a> {
|
||||
time: Read<'a, Time>,
|
||||
player: Read<'a, PlayerEntity>,
|
||||
entities: Entities<'a>,
|
||||
pos: WriteStorage<'a, Pos>,
|
||||
pos_interpdata: ReadStorage<'a, <Pos as InterpolatableComponent>::InterpData>,
|
||||
vel: WriteStorage<'a, Vel>,
|
||||
vel_interpdata: ReadStorage<'a, <Vel as InterpolatableComponent>::InterpData>,
|
||||
ori: WriteStorage<'a, Ori>,
|
||||
ori_interpdata: ReadStorage<'a, <Ori as InterpolatableComponent>::InterpData>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct InterpolationSystem;
|
||||
pub struct Sys;
|
||||
|
||||
impl<'a> System<'a> for InterpolationSystem {
|
||||
type SystemData = InterpolationSystemData<'a>;
|
||||
impl<'a> System<'a> for Sys {
|
||||
type SystemData = (
|
||||
ReadData<'a>,
|
||||
WriteStorage<'a, Pos>,
|
||||
WriteStorage<'a, Vel>,
|
||||
WriteStorage<'a, Ori>,
|
||||
);
|
||||
|
||||
const NAME: &'static str = "interpolation";
|
||||
const ORIGIN: Origin = Origin::Common;
|
||||
const PHASE: Phase = Phase::Apply;
|
||||
|
||||
fn run(_job: &mut Job<Self>, mut data: InterpolationSystemData<'a>) {
|
||||
fn run(_job: &mut Job<Self>, (data, mut pos, mut vel, mut ori): Self::SystemData) {
|
||||
let time = data.time.0;
|
||||
let player = data.player.0;
|
||||
|
||||
(
|
||||
&data.entities,
|
||||
&mut data.pos,
|
||||
&mut pos,
|
||||
&data.pos_interpdata,
|
||||
&data.vel_interpdata,
|
||||
)
|
||||
@ -54,7 +56,7 @@ impl<'a> System<'a> for InterpolationSystem {
|
||||
*pos = pos.interpolate(interp, time, vel);
|
||||
},
|
||||
);
|
||||
(&data.entities, &mut data.vel, &data.vel_interpdata)
|
||||
(&data.entities, &mut vel, &data.vel_interpdata)
|
||||
.par_join()
|
||||
.filter(|(e, _, _)| Some(e) != player.as_ref())
|
||||
.for_each_init(
|
||||
@ -66,7 +68,7 @@ impl<'a> System<'a> for InterpolationSystem {
|
||||
*vel = vel.interpolate(interp, time, &());
|
||||
},
|
||||
);
|
||||
(&data.entities, &mut data.ori, &data.ori_interpdata)
|
||||
(&data.entities, &mut ori, &data.ori_interpdata)
|
||||
.par_join()
|
||||
.filter(|(e, _, _)| Some(e) != player.as_ref())
|
||||
.for_each_init(
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(label_break_value, bool_to_option, option_unwrap_none, array_map)]
|
||||
#![feature(bool_to_option, option_unwrap_none, array_map)]
|
||||
#![allow(clippy::option_map_unit_fn)]
|
||||
|
||||
mod aura;
|
||||
@ -6,14 +6,12 @@ mod beam;
|
||||
mod buff;
|
||||
pub mod character_behavior;
|
||||
pub mod controller;
|
||||
mod interpolation;
|
||||
pub mod interpolation;
|
||||
pub mod melee;
|
||||
mod mount;
|
||||
pub mod phys;
|
||||
#[cfg(feature = "plugins")] pub mod plugin;
|
||||
pub mod projectile;
|
||||
mod shockwave;
|
||||
pub mod state;
|
||||
mod stats;
|
||||
|
||||
// External
|
||||
@ -21,12 +19,15 @@ use common_ecs::{dispatch, System};
|
||||
use specs::DispatcherBuilder;
|
||||
|
||||
pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) {
|
||||
//TODO: don't run interpolation on server
|
||||
dispatch::<interpolation::Sys>(dispatch_builder, &[]);
|
||||
dispatch::<mount::Sys>(dispatch_builder, &[]);
|
||||
dispatch::<controller::Sys>(dispatch_builder, &[&mount::Sys::sys_name()]);
|
||||
dispatch::<character_behavior::Sys>(dispatch_builder, &[&controller::Sys::sys_name()]);
|
||||
dispatch::<stats::Sys>(dispatch_builder, &[]);
|
||||
dispatch::<buff::Sys>(dispatch_builder, &[]);
|
||||
dispatch::<phys::Sys>(dispatch_builder, &[
|
||||
&interpolation::Sys::sys_name(),
|
||||
&controller::Sys::sys_name(),
|
||||
&mount::Sys::sys_name(),
|
||||
&stats::Sys::sys_name(),
|
||||
|
@ -8,7 +8,7 @@ edition = "2018"
|
||||
worldgen = []
|
||||
tracy = ["common/tracy", "common-base/tracy", "common-ecs/tracy", "common-sys/tracy", "common-net/tracy", "world/tracy"]
|
||||
simd = ["vek/platform_intrinsics"]
|
||||
plugins = ["common-sys/plugins"]
|
||||
plugins = ["common-state/plugins"]
|
||||
|
||||
default = ["worldgen", "plugins", "simd"]
|
||||
|
||||
@ -16,6 +16,7 @@ default = ["worldgen", "plugins", "simd"]
|
||||
common = { package = "veloren-common", path = "../common" }
|
||||
common-base = { package = "veloren-common-base", path = "../common/base" }
|
||||
common-ecs = { package = "veloren-common-ecs", path = "../common/ecs" }
|
||||
common-state = { package = "veloren-common-state", path = "../common/state" }
|
||||
common-sys = { package = "veloren-common-sys", path = "../common/sys" }
|
||||
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||
world = { package = "veloren-world", path = "../world" }
|
||||
|
@ -34,7 +34,7 @@ use common_net::{
|
||||
msg::{DisconnectReason, Notification, PlayerListUpdate, ServerGeneral},
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
use common_sys::state::{BuildAreaError, BuildAreas};
|
||||
use common_state::{BuildAreaError, BuildAreas};
|
||||
use core::{convert::TryFrom, ops::Not, time::Duration};
|
||||
use hashbrown::HashSet;
|
||||
use rand::Rng;
|
||||
|
@ -29,7 +29,7 @@ use common::{
|
||||
Damage, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
||||
};
|
||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||
use common_sys::state::BlockChange;
|
||||
use common_state::BlockChange;
|
||||
use comp::chat::GenericChatMsg;
|
||||
use hashbrown::HashSet;
|
||||
use specs::{join::Join, saveload::MarkerAllocator, Entity as EcsEntity, WorldExt};
|
||||
|
@ -9,7 +9,7 @@ use common::{
|
||||
uid::Uid,
|
||||
};
|
||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use specs::{
|
||||
world::{Entity, WorldExt},
|
||||
ReadStorage, WriteStorage,
|
||||
|
@ -17,7 +17,7 @@ use common::{
|
||||
vol::ReadVol,
|
||||
};
|
||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use comp::LightEmitter;
|
||||
|
||||
use crate::{client::Client, Server, StateExt};
|
||||
|
@ -10,7 +10,7 @@ use common::{
|
||||
};
|
||||
use common_base::span;
|
||||
use common_net::msg::{PlayerListUpdate, PresenceKind, ServerGeneral};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use specs::{saveload::MarkerAllocator, Builder, Entity as EcsEntity, WorldExt};
|
||||
use tracing::{debug, error, trace, warn, Instrument};
|
||||
|
||||
|
@ -77,10 +77,11 @@ use common_net::{
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
#[cfg(feature = "plugins")]
|
||||
use common_sys::plugin::memory_manager::EcsWorld;
|
||||
use common_state::plugin::memory_manager::EcsWorld;
|
||||
#[cfg(feature = "plugins")]
|
||||
use common_sys::plugin::PluginMgr;
|
||||
use common_sys::state::{BuildAreas, State};
|
||||
use common_state::plugin::PluginMgr;
|
||||
use common_state::{BuildAreas, State};
|
||||
use common_sys::add_local_systems;
|
||||
use metrics::{EcsSystemMetrics, PhysicsMetrics, TickMetrics};
|
||||
use network::{Network, Pid, ProtocolAddr};
|
||||
use persistence::{
|
||||
@ -517,6 +518,7 @@ impl Server {
|
||||
self.state.tick(
|
||||
dt,
|
||||
|dispatcher_builder| {
|
||||
add_local_systems(dispatcher_builder);
|
||||
sys::msg::add_server_systems(dispatcher_builder);
|
||||
sys::add_server_systems(dispatcher_builder);
|
||||
#[cfg(feature = "worldgen")]
|
||||
|
@ -2,9 +2,9 @@ use crate::settings::BanRecord;
|
||||
use authc::{AuthClient, AuthClientError, AuthToken, Uuid};
|
||||
use common_net::msg::RegisterError;
|
||||
#[cfg(feature = "plugins")]
|
||||
use common_sys::plugin::memory_manager::EcsWorld;
|
||||
use common_state::plugin::memory_manager::EcsWorld;
|
||||
#[cfg(feature = "plugins")]
|
||||
use common_sys::plugin::PluginMgr;
|
||||
use common_state::plugin::PluginMgr;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use plugin_api::event::{PlayerJoinEvent, PlayerJoinResult};
|
||||
use specs::Component;
|
||||
@ -167,9 +167,17 @@ impl LoginProvider {
|
||||
let token = AuthToken::from_str(username_or_token)
|
||||
.map_err(|e| RegisterError::AuthError(e.to_string()))?;
|
||||
// Validate token
|
||||
let uuid = srv.validate(token).await?;
|
||||
let username = srv.uuid_to_username(uuid).await?;
|
||||
Ok((username, uuid))
|
||||
match async {
|
||||
let uuid = srv.validate(token).await?;
|
||||
let username = srv.uuid_to_username(uuid).await?;
|
||||
let r: Result<_, authc::AuthClientError> = Ok((username, uuid));
|
||||
r
|
||||
}
|
||||
.await
|
||||
{
|
||||
Err(e) => Err(RegisterError::AuthError(e.to_string())),
|
||||
Ok((username, uuid)) => Ok((username, uuid)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn username_to_uuid(&self, username: &str) -> Result<Uuid, AuthClientError> {
|
||||
|
@ -14,7 +14,7 @@ use common::{
|
||||
vol::RectRasterableVol,
|
||||
};
|
||||
use common_ecs::{dispatch, System};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use rand::prelude::*;
|
||||
use slab::Slab;
|
||||
use specs::{DispatcherBuilder, WorldExt};
|
||||
|
@ -18,7 +18,7 @@ use common_net::{
|
||||
msg::{CharacterInfo, PlayerListUpdate, PresenceKind, ServerGeneral},
|
||||
sync::WorldSyncExt,
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use rand::prelude::*;
|
||||
use specs::{
|
||||
saveload::MarkerAllocator, Builder, Entity as EcsEntity, EntityBuilder as EcsEntityBuilder,
|
||||
|
@ -23,6 +23,7 @@ pub type PersistenceScheduler = SysScheduler<persistence::Sys>;
|
||||
|
||||
pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) {
|
||||
dispatch::<melee::Sys>(dispatch_builder, &[&projectile::Sys::sys_name()]);
|
||||
//Note: server should not depend on interpolation system
|
||||
dispatch::<agent::Sys>(dispatch_builder, &[]);
|
||||
dispatch::<terrain::Sys>(dispatch_builder, &[]);
|
||||
dispatch::<waypoint::Sys>(dispatch_builder, &[]);
|
||||
|
@ -10,7 +10,7 @@ use common::{
|
||||
};
|
||||
use common_ecs::{Job, Origin, Phase, System};
|
||||
use common_net::msg::{ClientGeneral, PresenceKind, ServerGeneral};
|
||||
use common_sys::state::{BlockChange, BuildAreas};
|
||||
use common_state::{BlockChange, BuildAreas};
|
||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, Write, WriteStorage};
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
|
@ -20,10 +20,10 @@ use specs::{Entities, Join, Read, ReadExpect, ReadStorage, WriteExpect, WriteSto
|
||||
use tracing::trace;
|
||||
|
||||
#[cfg(feature = "plugins")]
|
||||
use common_sys::plugin::memory_manager::EcsWorld;
|
||||
use common_state::plugin::memory_manager::EcsWorld;
|
||||
|
||||
#[cfg(feature = "plugins")]
|
||||
use common_sys::plugin::PluginMgr;
|
||||
use common_state::plugin::PluginMgr;
|
||||
|
||||
#[cfg(feature = "plugins")]
|
||||
type ReadPlugin<'a> = Read<'a, PluginMgr>;
|
||||
|
@ -15,7 +15,7 @@ use common::{
|
||||
};
|
||||
use common_ecs::{Job, Origin, Phase, System};
|
||||
use common_net::msg::ServerGeneral;
|
||||
use common_sys::state::TerrainChanges;
|
||||
use common_state::TerrainChanges;
|
||||
use comp::Behavior;
|
||||
use specs::{Join, Read, ReadStorage, Write, WriteExpect};
|
||||
use std::sync::Arc;
|
||||
|
@ -2,7 +2,7 @@ use crate::{client::Client, presence::Presence};
|
||||
use common::{comp::Pos, terrain::TerrainGrid};
|
||||
use common_ecs::{Job, Origin, Phase, System};
|
||||
use common_net::msg::ServerGeneral;
|
||||
use common_sys::state::TerrainChanges;
|
||||
use common_state::TerrainChanges;
|
||||
use specs::{Join, Read, ReadExpect, ReadStorage};
|
||||
|
||||
/// This systems sends new chunks to clients as well as changes to existing
|
||||
|
@ -24,7 +24,7 @@ gl = ["gfx_device_gl", "gfx_gl"]
|
||||
hot-anim = ["anim/use-dyn-lib"]
|
||||
singleplayer = ["server"]
|
||||
simd = ["vek/platform_intrinsics"]
|
||||
tracy = ["common/tracy", "common-ecs/tracy", "common-frontend/tracy", "common-net/tracy", "common-sys/tracy", "client/tracy"]
|
||||
tracy = ["common/tracy", "common-ecs/tracy", "common-frontend/tracy", "common-net/tracy", "common-state/tracy", "client/tracy"]
|
||||
plugins = ["client/plugins"]
|
||||
|
||||
default = ["gl", "singleplayer", "native-dialog", "plugins", "simd"]
|
||||
@ -36,6 +36,7 @@ common-base = {package = "veloren-common-base", path = "../common/base"}
|
||||
common-ecs = {package = "veloren-common-ecs", path = "../common/ecs"}
|
||||
common-frontend = {package = "veloren-common-frontend", path = "../common/frontend"}
|
||||
common-net = {package = "veloren-common-net", path = "../common/net"}
|
||||
common-state = {package = "veloren-common-state", path = "../common/state"}
|
||||
common-sys = {package = "veloren-common-sys", path = "../common/sys"}
|
||||
|
||||
anim = {package = "veloren-voxygen-anim", path = "anim"}
|
||||
|
@ -8,7 +8,7 @@ use common::{
|
||||
assets::{self, AssetExt, AssetHandle},
|
||||
vol::ReadVol,
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use serde::Deserialize;
|
||||
use std::time::Instant;
|
||||
use tracing::warn;
|
||||
|
@ -49,7 +49,7 @@ use common::{
|
||||
assets::{self, AssetExt, AssetHandle},
|
||||
terrain::{BiomeKind, SitesKind},
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use hashbrown::HashMap;
|
||||
use rand::{prelude::SliceRandom, thread_rng, Rng};
|
||||
use serde::Deserialize;
|
||||
|
@ -14,7 +14,7 @@ use common::{
|
||||
terrain::TerrainChunk,
|
||||
vol::{ReadVol, RectRasterableVol},
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use hashbrown::HashMap;
|
||||
use rand::{thread_rng, Rng};
|
||||
use std::time::{Duration, Instant};
|
||||
|
@ -13,7 +13,7 @@ use common::{
|
||||
terrain::TerrainChunk,
|
||||
vol::ReadVol,
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use hashbrown::HashMap;
|
||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||
use std::time::{Duration, Instant};
|
||||
|
@ -17,7 +17,7 @@ use common::{
|
||||
terrain::TerrainChunk,
|
||||
vol::ReadVol,
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use hashbrown::HashMap;
|
||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||
use std::time::{Duration, Instant};
|
||||
|
@ -5,7 +5,7 @@ mod movement;
|
||||
|
||||
use client::Client;
|
||||
use common::terrain::TerrainChunk;
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
|
||||
use block::BlockEventMapper;
|
||||
use campfire::CampfireEventMapper;
|
||||
|
@ -14,7 +14,7 @@ use common::{
|
||||
terrain::{BlockKind, TerrainChunk},
|
||||
vol::ReadVol,
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use hashbrown::HashMap;
|
||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||
use std::time::{Duration, Instant};
|
||||
|
@ -98,7 +98,7 @@ use common::{
|
||||
outcome::Outcome,
|
||||
terrain::{BlockKind, TerrainChunk},
|
||||
};
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use event_mapper::SfxEventMapper;
|
||||
use hashbrown::HashMap;
|
||||
use rand::prelude::*;
|
||||
|
@ -39,7 +39,7 @@ use common::{
|
||||
vol::RectRasterableVol,
|
||||
};
|
||||
use common_base::span;
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use core::{
|
||||
borrow::Borrow,
|
||||
convert::TryFrom,
|
||||
|
@ -32,7 +32,7 @@ use common::{
|
||||
vol::ReadVol,
|
||||
};
|
||||
use common_base::span;
|
||||
use common_sys::state::State;
|
||||
use common_state::State;
|
||||
use comp::item::Reagent;
|
||||
use num::traits::{Float, FloatConst};
|
||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||
|
Loading…
Reference in New Issue
Block a user