mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
seperate sys/state
This commit is contained in:
parent
c5455fa1a1
commit
5862920f32
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -5442,6 +5442,7 @@ dependencies = [
|
|||||||
"veloren-common-ecs",
|
"veloren-common-ecs",
|
||||||
"veloren-common-frontend",
|
"veloren-common-frontend",
|
||||||
"veloren-common-net",
|
"veloren-common-net",
|
||||||
|
"veloren-common-state",
|
||||||
"veloren-common-sys",
|
"veloren-common-sys",
|
||||||
"veloren-network",
|
"veloren-network",
|
||||||
]
|
]
|
||||||
@ -5535,18 +5536,14 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "veloren-common-sys"
|
name = "veloren-common-state"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
"indexmap",
|
|
||||||
"ordered-float 2.1.1",
|
|
||||||
"rand 0.8.3",
|
|
||||||
"rayon",
|
"rayon",
|
||||||
"scopeguard",
|
"scopeguard",
|
||||||
"serde",
|
"serde",
|
||||||
"slab",
|
|
||||||
"specs",
|
"specs",
|
||||||
"tar",
|
"tar",
|
||||||
"toml",
|
"toml",
|
||||||
@ -5560,6 +5557,25 @@ dependencies = [
|
|||||||
"wasmer",
|
"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]]
|
[[package]]
|
||||||
name = "veloren-network"
|
name = "veloren-network"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
@ -5666,6 +5682,7 @@ dependencies = [
|
|||||||
"veloren-common-base",
|
"veloren-common-base",
|
||||||
"veloren-common-ecs",
|
"veloren-common-ecs",
|
||||||
"veloren-common-net",
|
"veloren-common-net",
|
||||||
|
"veloren-common-state",
|
||||||
"veloren-common-sys",
|
"veloren-common-sys",
|
||||||
"veloren-network",
|
"veloren-network",
|
||||||
"veloren-plugin-api",
|
"veloren-plugin-api",
|
||||||
@ -5753,6 +5770,7 @@ dependencies = [
|
|||||||
"veloren-common-ecs",
|
"veloren-common-ecs",
|
||||||
"veloren-common-frontend",
|
"veloren-common-frontend",
|
||||||
"veloren-common-net",
|
"veloren-common-net",
|
||||||
|
"veloren-common-state",
|
||||||
"veloren-common-sys",
|
"veloren-common-sys",
|
||||||
"veloren-server",
|
"veloren-server",
|
||||||
"veloren-voxygen-anim",
|
"veloren-voxygen-anim",
|
||||||
|
@ -6,6 +6,7 @@ members = [
|
|||||||
"common/base",
|
"common/base",
|
||||||
"common/ecs",
|
"common/ecs",
|
||||||
"common/net",
|
"common/net",
|
||||||
|
"common/state",
|
||||||
"common/sys",
|
"common/sys",
|
||||||
"common/frontend",
|
"common/frontend",
|
||||||
"client",
|
"client",
|
||||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
|||||||
[features]
|
[features]
|
||||||
tracy = ["common/tracy", "common-base/tracy", "common-sys/tracy", "common-net/tracy", "common-frontend/tracy"]
|
tracy = ["common/tracy", "common-base/tracy", "common-sys/tracy", "common-net/tracy", "common-frontend/tracy"]
|
||||||
simd = ["vek/platform_intrinsics"]
|
simd = ["vek/platform_intrinsics"]
|
||||||
plugins = ["common-sys/plugins"]
|
plugins = ["common-state/plugins"]
|
||||||
bin_bot = ["common-ecs", "serde", "ron", "clap", "rustyline", "common-frontend", "async-channel"]
|
bin_bot = ["common-ecs", "serde", "ron", "clap", "rustyline", "common-frontend", "async-channel"]
|
||||||
|
|
||||||
default = ["simd"]
|
default = ["simd"]
|
||||||
@ -15,6 +15,7 @@ default = ["simd"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
common = { package = "veloren-common", path = "../common", features = ["no-assets"] }
|
common = { package = "veloren-common", path = "../common", features = ["no-assets"] }
|
||||||
common-base = { package = "veloren-common-base", path = "../common/base" }
|
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-sys = { package = "veloren-common-sys", path = "../common/sys", default-features = false }
|
||||||
common-net = { package = "veloren-common-net", path = "../common/net" }
|
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||||
network = { package = "veloren-network", path = "../network", features = ["compression"], default-features = false }
|
network = { package = "veloren-network", path = "../network", features = ["compression"], default-features = false }
|
||||||
|
@ -54,7 +54,8 @@ use common_net::{
|
|||||||
},
|
},
|
||||||
sync::WorldSyncExt,
|
sync::WorldSyncExt,
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
|
use common_sys::add_local_systems;
|
||||||
use comp::BuffKind;
|
use comp::BuffKind;
|
||||||
use futures_util::FutureExt;
|
use futures_util::FutureExt;
|
||||||
use hashbrown::{HashMap, HashSet};
|
use hashbrown::{HashMap, HashSet};
|
||||||
@ -1418,7 +1419,8 @@ impl Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4) Tick the client's LocalState
|
// 4) Tick the client's LocalState
|
||||||
self.state.tick(dt, add_foreign_systems, true);
|
self.state
|
||||||
|
.tick(dt, add_local_systems, add_foreign_systems, true);
|
||||||
// TODO: avoid emitting these in the first place
|
// TODO: avoid emitting these in the first place
|
||||||
self.state
|
self.state
|
||||||
.ecs()
|
.ecs()
|
||||||
|
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")]
|
#[cfg(feature = "plugins")]
|
||||||
use crate::plugin::memory_manager::EcsWorld;
|
use crate::plugin::memory_manager::EcsWorld;
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
@ -18,7 +20,7 @@ use common::{
|
|||||||
vol::{ReadVol, WriteVol},
|
vol::{ReadVol, WriteVol},
|
||||||
};
|
};
|
||||||
use common_base::span;
|
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 common_net::sync::{interpolation as sync_interp, WorldSyncExt};
|
||||||
use core::{convert::identity, time::Duration};
|
use core::{convert::identity, time::Duration};
|
||||||
use hashbrown::{hash_map, HashMap, HashSet};
|
use hashbrown::{hash_map, HashMap, HashSet};
|
||||||
@ -506,6 +508,7 @@ impl State {
|
|||||||
pub fn tick(
|
pub fn tick(
|
||||||
&mut self,
|
&mut self,
|
||||||
dt: Duration,
|
dt: Duration,
|
||||||
|
add_local_systems: impl Fn(&mut DispatcherBuilder),
|
||||||
add_foreign_systems: impl Fn(&mut DispatcherBuilder),
|
add_foreign_systems: impl Fn(&mut DispatcherBuilder),
|
||||||
update_terrain_and_regions: bool,
|
update_terrain_and_regions: bool,
|
||||||
) {
|
) {
|
||||||
@ -528,14 +531,13 @@ impl State {
|
|||||||
// Create and run a dispatcher for ecs systems.
|
// Create and run a dispatcher for ecs systems.
|
||||||
let mut dispatch_builder =
|
let mut dispatch_builder =
|
||||||
DispatcherBuilder::new().with_pool(Arc::clone(&self.thread_pool));
|
DispatcherBuilder::new().with_pool(Arc::clone(&self.thread_pool));
|
||||||
crate::add_local_systems(&mut dispatch_builder);
|
|
||||||
// TODO: Consider alternative ways to do this
|
// TODO: Consider alternative ways to do this
|
||||||
|
add_local_systems(&mut dispatch_builder);
|
||||||
add_foreign_systems(&mut dispatch_builder);
|
add_foreign_systems(&mut dispatch_builder);
|
||||||
// This dispatches all the systems in parallel.
|
// This dispatches all the systems in parallel.
|
||||||
let mut dispatcher = dispatch_builder.build();
|
let mut dispatcher = dispatch_builder.build();
|
||||||
drop(guard);
|
drop(guard);
|
||||||
span!(guard, "run systems");
|
span!(guard, "run systems");
|
||||||
run_now::<crate::interpolation::InterpolationSystem>(&self.ecs);
|
|
||||||
dispatcher.dispatch(&self.ecs);
|
dispatcher.dispatch(&self.ecs);
|
||||||
drop(guard);
|
drop(guard);
|
||||||
|
|
@ -7,7 +7,6 @@ version = "0.9.0"
|
|||||||
[features]
|
[features]
|
||||||
tracy = ["common/tracy"]
|
tracy = ["common/tracy"]
|
||||||
simd = ["vek/platform_intrinsics"]
|
simd = ["vek/platform_intrinsics"]
|
||||||
plugins = ["toml", "tar", "wasmer", "bincode", "plugin-api"]
|
|
||||||
|
|
||||||
default = ["simd"]
|
default = ["simd"]
|
||||||
|
|
||||||
@ -31,16 +30,5 @@ slab = "0.4.2"
|
|||||||
# ECS
|
# ECS
|
||||||
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control", "derive"], rev = "5a9b71035007be0e3574f35184acac1cd4530496" }
|
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
|
# Tweak running code
|
||||||
#inline_tweak = { version = "1.0.8", features = ["release_tweak"] }
|
#inline_tweak = { version = "1.0.8", features = ["release_tweak"] }
|
||||||
|
@ -11,35 +11,37 @@ use specs::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[derive(SystemData)]
|
#[derive(SystemData)]
|
||||||
pub struct InterpolationSystemData<'a> {
|
pub struct ReadData<'a> {
|
||||||
time: Read<'a, Time>,
|
time: Read<'a, Time>,
|
||||||
player: Read<'a, PlayerEntity>,
|
player: Read<'a, PlayerEntity>,
|
||||||
entities: Entities<'a>,
|
entities: Entities<'a>,
|
||||||
pos: WriteStorage<'a, Pos>,
|
|
||||||
pos_interpdata: ReadStorage<'a, <Pos as InterpolatableComponent>::InterpData>,
|
pos_interpdata: ReadStorage<'a, <Pos as InterpolatableComponent>::InterpData>,
|
||||||
vel: WriteStorage<'a, Vel>,
|
|
||||||
vel_interpdata: ReadStorage<'a, <Vel as InterpolatableComponent>::InterpData>,
|
vel_interpdata: ReadStorage<'a, <Vel as InterpolatableComponent>::InterpData>,
|
||||||
ori: WriteStorage<'a, Ori>,
|
|
||||||
ori_interpdata: ReadStorage<'a, <Ori as InterpolatableComponent>::InterpData>,
|
ori_interpdata: ReadStorage<'a, <Ori as InterpolatableComponent>::InterpData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct InterpolationSystem;
|
pub struct Sys;
|
||||||
|
|
||||||
impl<'a> System<'a> for InterpolationSystem {
|
impl<'a> System<'a> for Sys {
|
||||||
type SystemData = InterpolationSystemData<'a>;
|
type SystemData = (
|
||||||
|
ReadData<'a>,
|
||||||
|
WriteStorage<'a, Pos>,
|
||||||
|
WriteStorage<'a, Vel>,
|
||||||
|
WriteStorage<'a, Ori>,
|
||||||
|
);
|
||||||
|
|
||||||
const NAME: &'static str = "interpolation";
|
const NAME: &'static str = "interpolation";
|
||||||
const ORIGIN: Origin = Origin::Common;
|
const ORIGIN: Origin = Origin::Common;
|
||||||
const PHASE: Phase = Phase::Apply;
|
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 time = data.time.0;
|
||||||
let player = data.player.0;
|
let player = data.player.0;
|
||||||
|
|
||||||
(
|
(
|
||||||
&data.entities,
|
&data.entities,
|
||||||
&mut data.pos,
|
&mut pos,
|
||||||
&data.pos_interpdata,
|
&data.pos_interpdata,
|
||||||
&data.vel_interpdata,
|
&data.vel_interpdata,
|
||||||
)
|
)
|
||||||
@ -54,7 +56,7 @@ impl<'a> System<'a> for InterpolationSystem {
|
|||||||
*pos = pos.interpolate(interp, time, vel);
|
*pos = pos.interpolate(interp, time, vel);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
(&data.entities, &mut data.vel, &data.vel_interpdata)
|
(&data.entities, &mut vel, &data.vel_interpdata)
|
||||||
.par_join()
|
.par_join()
|
||||||
.filter(|(e, _, _)| Some(e) != player.as_ref())
|
.filter(|(e, _, _)| Some(e) != player.as_ref())
|
||||||
.for_each_init(
|
.for_each_init(
|
||||||
@ -66,7 +68,7 @@ impl<'a> System<'a> for InterpolationSystem {
|
|||||||
*vel = vel.interpolate(interp, time, &());
|
*vel = vel.interpolate(interp, time, &());
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
(&data.entities, &mut data.ori, &data.ori_interpdata)
|
(&data.entities, &mut ori, &data.ori_interpdata)
|
||||||
.par_join()
|
.par_join()
|
||||||
.filter(|(e, _, _)| Some(e) != player.as_ref())
|
.filter(|(e, _, _)| Some(e) != player.as_ref())
|
||||||
.for_each_init(
|
.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)]
|
#![allow(clippy::option_map_unit_fn)]
|
||||||
|
|
||||||
mod aura;
|
mod aura;
|
||||||
@ -6,14 +6,12 @@ mod beam;
|
|||||||
mod buff;
|
mod buff;
|
||||||
pub mod character_behavior;
|
pub mod character_behavior;
|
||||||
pub mod controller;
|
pub mod controller;
|
||||||
mod interpolation;
|
pub mod interpolation;
|
||||||
pub mod melee;
|
pub mod melee;
|
||||||
mod mount;
|
mod mount;
|
||||||
pub mod phys;
|
pub mod phys;
|
||||||
#[cfg(feature = "plugins")] pub mod plugin;
|
|
||||||
pub mod projectile;
|
pub mod projectile;
|
||||||
mod shockwave;
|
mod shockwave;
|
||||||
pub mod state;
|
|
||||||
mod stats;
|
mod stats;
|
||||||
|
|
||||||
// External
|
// External
|
||||||
@ -21,12 +19,14 @@ use common_ecs::{dispatch, System};
|
|||||||
use specs::DispatcherBuilder;
|
use specs::DispatcherBuilder;
|
||||||
|
|
||||||
pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) {
|
pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) {
|
||||||
|
dispatch::<interpolation::Sys>(dispatch_builder, &[]);
|
||||||
dispatch::<mount::Sys>(dispatch_builder, &[]);
|
dispatch::<mount::Sys>(dispatch_builder, &[]);
|
||||||
dispatch::<controller::Sys>(dispatch_builder, &[&mount::Sys::sys_name()]);
|
dispatch::<controller::Sys>(dispatch_builder, &[&mount::Sys::sys_name()]);
|
||||||
dispatch::<character_behavior::Sys>(dispatch_builder, &[&controller::Sys::sys_name()]);
|
dispatch::<character_behavior::Sys>(dispatch_builder, &[&controller::Sys::sys_name()]);
|
||||||
dispatch::<stats::Sys>(dispatch_builder, &[]);
|
dispatch::<stats::Sys>(dispatch_builder, &[]);
|
||||||
dispatch::<buff::Sys>(dispatch_builder, &[]);
|
dispatch::<buff::Sys>(dispatch_builder, &[]);
|
||||||
dispatch::<phys::Sys>(dispatch_builder, &[
|
dispatch::<phys::Sys>(dispatch_builder, &[
|
||||||
|
&interpolation::Sys::sys_name(),
|
||||||
&controller::Sys::sys_name(),
|
&controller::Sys::sys_name(),
|
||||||
&mount::Sys::sys_name(),
|
&mount::Sys::sys_name(),
|
||||||
&stats::Sys::sys_name(),
|
&stats::Sys::sys_name(),
|
||||||
|
@ -8,7 +8,7 @@ edition = "2018"
|
|||||||
worldgen = []
|
worldgen = []
|
||||||
tracy = ["common/tracy", "common-base/tracy", "common-ecs/tracy", "common-sys/tracy", "common-net/tracy", "world/tracy"]
|
tracy = ["common/tracy", "common-base/tracy", "common-ecs/tracy", "common-sys/tracy", "common-net/tracy", "world/tracy"]
|
||||||
simd = ["vek/platform_intrinsics"]
|
simd = ["vek/platform_intrinsics"]
|
||||||
plugins = ["common-sys/plugins"]
|
plugins = ["common-state/plugins"]
|
||||||
|
|
||||||
default = ["worldgen", "plugins", "simd"]
|
default = ["worldgen", "plugins", "simd"]
|
||||||
|
|
||||||
@ -16,6 +16,7 @@ default = ["worldgen", "plugins", "simd"]
|
|||||||
common = { package = "veloren-common", path = "../common" }
|
common = { package = "veloren-common", path = "../common" }
|
||||||
common-base = { package = "veloren-common-base", path = "../common/base" }
|
common-base = { package = "veloren-common-base", path = "../common/base" }
|
||||||
common-ecs = { package = "veloren-common-ecs", path = "../common/ecs" }
|
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-sys = { package = "veloren-common-sys", path = "../common/sys" }
|
||||||
common-net = { package = "veloren-common-net", path = "../common/net" }
|
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||||
world = { package = "veloren-world", path = "../world" }
|
world = { package = "veloren-world", path = "../world" }
|
||||||
|
@ -34,7 +34,7 @@ use common_net::{
|
|||||||
msg::{DisconnectReason, Notification, PlayerListUpdate, ServerGeneral},
|
msg::{DisconnectReason, Notification, PlayerListUpdate, ServerGeneral},
|
||||||
sync::WorldSyncExt,
|
sync::WorldSyncExt,
|
||||||
};
|
};
|
||||||
use common_sys::state::{BuildAreaError, BuildAreas};
|
use common_state::{BuildAreaError, BuildAreas};
|
||||||
use core::{convert::TryFrom, ops::Not, time::Duration};
|
use core::{convert::TryFrom, ops::Not, time::Duration};
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
@ -29,7 +29,7 @@ use common::{
|
|||||||
Damage, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
Damage, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
||||||
};
|
};
|
||||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||||
use common_sys::state::BlockChange;
|
use common_state::BlockChange;
|
||||||
use comp::chat::GenericChatMsg;
|
use comp::chat::GenericChatMsg;
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use specs::{join::Join, saveload::MarkerAllocator, Entity as EcsEntity, WorldExt};
|
use specs::{join::Join, saveload::MarkerAllocator, Entity as EcsEntity, WorldExt};
|
||||||
|
@ -9,7 +9,7 @@ use common::{
|
|||||||
uid::Uid,
|
uid::Uid,
|
||||||
};
|
};
|
||||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use specs::{
|
use specs::{
|
||||||
world::{Entity, WorldExt},
|
world::{Entity, WorldExt},
|
||||||
ReadStorage, WriteStorage,
|
ReadStorage, WriteStorage,
|
||||||
|
@ -17,7 +17,7 @@ use common::{
|
|||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use comp::LightEmitter;
|
use comp::LightEmitter;
|
||||||
|
|
||||||
use crate::{client::Client, Server, StateExt};
|
use crate::{client::Client, Server, StateExt};
|
||||||
|
@ -10,7 +10,7 @@ use common::{
|
|||||||
};
|
};
|
||||||
use common_base::span;
|
use common_base::span;
|
||||||
use common_net::msg::{PlayerListUpdate, PresenceKind, ServerGeneral};
|
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 specs::{saveload::MarkerAllocator, Builder, Entity as EcsEntity, WorldExt};
|
||||||
use tracing::{debug, error, trace, warn, Instrument};
|
use tracing::{debug, error, trace, warn, Instrument};
|
||||||
|
|
||||||
|
@ -77,10 +77,11 @@ use common_net::{
|
|||||||
sync::WorldSyncExt,
|
sync::WorldSyncExt,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
use common_sys::plugin::memory_manager::EcsWorld;
|
use common_state::plugin::memory_manager::EcsWorld;
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
use common_sys::plugin::PluginMgr;
|
use common_state::plugin::PluginMgr;
|
||||||
use common_sys::state::{BuildAreas, State};
|
use common_state::{BuildAreas, State};
|
||||||
|
use common_sys::add_local_systems;
|
||||||
use metrics::{EcsSystemMetrics, PhysicsMetrics, TickMetrics};
|
use metrics::{EcsSystemMetrics, PhysicsMetrics, TickMetrics};
|
||||||
use network::{Network, Pid, ProtocolAddr};
|
use network::{Network, Pid, ProtocolAddr};
|
||||||
use persistence::{
|
use persistence::{
|
||||||
@ -516,6 +517,7 @@ impl Server {
|
|||||||
// in sys/terrain.rs
|
// in sys/terrain.rs
|
||||||
self.state.tick(
|
self.state.tick(
|
||||||
dt,
|
dt,
|
||||||
|
add_local_systems,
|
||||||
|dispatcher_builder| {
|
|dispatcher_builder| {
|
||||||
sys::msg::add_server_systems(dispatcher_builder);
|
sys::msg::add_server_systems(dispatcher_builder);
|
||||||
sys::add_server_systems(dispatcher_builder);
|
sys::add_server_systems(dispatcher_builder);
|
||||||
|
@ -2,9 +2,9 @@ use crate::settings::BanRecord;
|
|||||||
use authc::{AuthClient, AuthClientError, AuthToken, Uuid};
|
use authc::{AuthClient, AuthClientError, AuthToken, Uuid};
|
||||||
use common_net::msg::RegisterError;
|
use common_net::msg::RegisterError;
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
use common_sys::plugin::memory_manager::EcsWorld;
|
use common_state::plugin::memory_manager::EcsWorld;
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
use common_sys::plugin::PluginMgr;
|
use common_state::plugin::PluginMgr;
|
||||||
use hashbrown::{HashMap, HashSet};
|
use hashbrown::{HashMap, HashSet};
|
||||||
use plugin_api::event::{PlayerJoinEvent, PlayerJoinResult};
|
use plugin_api::event::{PlayerJoinEvent, PlayerJoinResult};
|
||||||
use specs::Component;
|
use specs::Component;
|
||||||
|
@ -14,7 +14,7 @@ use common::{
|
|||||||
vol::RectRasterableVol,
|
vol::RectRasterableVol,
|
||||||
};
|
};
|
||||||
use common_ecs::{dispatch, System};
|
use common_ecs::{dispatch, System};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
use specs::{DispatcherBuilder, WorldExt};
|
use specs::{DispatcherBuilder, WorldExt};
|
||||||
|
@ -18,7 +18,7 @@ use common_net::{
|
|||||||
msg::{CharacterInfo, PlayerListUpdate, PresenceKind, ServerGeneral},
|
msg::{CharacterInfo, PlayerListUpdate, PresenceKind, ServerGeneral},
|
||||||
sync::WorldSyncExt,
|
sync::WorldSyncExt,
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use specs::{
|
use specs::{
|
||||||
saveload::MarkerAllocator, Builder, Entity as EcsEntity, EntityBuilder as EcsEntityBuilder,
|
saveload::MarkerAllocator, Builder, Entity as EcsEntity, EntityBuilder as EcsEntityBuilder,
|
||||||
|
@ -12,7 +12,7 @@ pub mod terrain_sync;
|
|||||||
pub mod waypoint;
|
pub mod waypoint;
|
||||||
|
|
||||||
use common_ecs::{dispatch, run_now, System};
|
use common_ecs::{dispatch, run_now, System};
|
||||||
use common_sys::{melee, projectile};
|
use common_sys::{interpolation, melee, projectile};
|
||||||
use specs::DispatcherBuilder;
|
use specs::DispatcherBuilder;
|
||||||
use std::{
|
use std::{
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
@ -23,7 +23,7 @@ pub type PersistenceScheduler = SysScheduler<persistence::Sys>;
|
|||||||
|
|
||||||
pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) {
|
pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) {
|
||||||
dispatch::<melee::Sys>(dispatch_builder, &[&projectile::Sys::sys_name()]);
|
dispatch::<melee::Sys>(dispatch_builder, &[&projectile::Sys::sys_name()]);
|
||||||
dispatch::<agent::Sys>(dispatch_builder, &[]);
|
dispatch::<agent::Sys>(dispatch_builder, &[&interpolation::Sys::sys_name()]);
|
||||||
dispatch::<terrain::Sys>(dispatch_builder, &[]);
|
dispatch::<terrain::Sys>(dispatch_builder, &[]);
|
||||||
dispatch::<waypoint::Sys>(dispatch_builder, &[]);
|
dispatch::<waypoint::Sys>(dispatch_builder, &[]);
|
||||||
dispatch::<invite_timeout::Sys>(dispatch_builder, &[]);
|
dispatch::<invite_timeout::Sys>(dispatch_builder, &[]);
|
||||||
|
@ -10,7 +10,7 @@ use common::{
|
|||||||
};
|
};
|
||||||
use common_ecs::{Job, Origin, Phase, System};
|
use common_ecs::{Job, Origin, Phase, System};
|
||||||
use common_net::msg::{ClientGeneral, PresenceKind, ServerGeneral};
|
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 specs::{Entities, Join, Read, ReadExpect, ReadStorage, Write, WriteStorage};
|
||||||
use tracing::{debug, trace, warn};
|
use tracing::{debug, trace, warn};
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@ use specs::{Entities, Join, Read, ReadExpect, ReadStorage, WriteExpect, WriteSto
|
|||||||
use tracing::trace;
|
use tracing::trace;
|
||||||
|
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
use common_sys::plugin::memory_manager::EcsWorld;
|
use common_state::plugin::memory_manager::EcsWorld;
|
||||||
|
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
use common_sys::plugin::PluginMgr;
|
use common_state::plugin::PluginMgr;
|
||||||
|
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
type ReadPlugin<'a> = Read<'a, PluginMgr>;
|
type ReadPlugin<'a> = Read<'a, PluginMgr>;
|
||||||
|
@ -15,7 +15,7 @@ use common::{
|
|||||||
};
|
};
|
||||||
use common_ecs::{Job, Origin, Phase, System};
|
use common_ecs::{Job, Origin, Phase, System};
|
||||||
use common_net::msg::ServerGeneral;
|
use common_net::msg::ServerGeneral;
|
||||||
use common_sys::state::TerrainChanges;
|
use common_state::TerrainChanges;
|
||||||
use comp::Behavior;
|
use comp::Behavior;
|
||||||
use specs::{Join, Read, ReadStorage, Write, WriteExpect};
|
use specs::{Join, Read, ReadStorage, Write, WriteExpect};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -2,7 +2,7 @@ use crate::{client::Client, presence::Presence};
|
|||||||
use common::{comp::Pos, terrain::TerrainGrid};
|
use common::{comp::Pos, terrain::TerrainGrid};
|
||||||
use common_ecs::{Job, Origin, Phase, System};
|
use common_ecs::{Job, Origin, Phase, System};
|
||||||
use common_net::msg::ServerGeneral;
|
use common_net::msg::ServerGeneral;
|
||||||
use common_sys::state::TerrainChanges;
|
use common_state::TerrainChanges;
|
||||||
use specs::{Join, Read, ReadExpect, ReadStorage};
|
use specs::{Join, Read, ReadExpect, ReadStorage};
|
||||||
|
|
||||||
/// This systems sends new chunks to clients as well as changes to existing
|
/// 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"]
|
hot-anim = ["anim/use-dyn-lib"]
|
||||||
singleplayer = ["server"]
|
singleplayer = ["server"]
|
||||||
simd = ["vek/platform_intrinsics"]
|
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"]
|
plugins = ["client/plugins"]
|
||||||
|
|
||||||
default = ["gl", "singleplayer", "native-dialog", "plugins", "simd"]
|
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-ecs = {package = "veloren-common-ecs", path = "../common/ecs"}
|
||||||
common-frontend = {package = "veloren-common-frontend", path = "../common/frontend"}
|
common-frontend = {package = "veloren-common-frontend", path = "../common/frontend"}
|
||||||
common-net = {package = "veloren-common-net", path = "../common/net"}
|
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"}
|
common-sys = {package = "veloren-common-sys", path = "../common/sys"}
|
||||||
|
|
||||||
anim = {package = "veloren-voxygen-anim", path = "anim"}
|
anim = {package = "veloren-voxygen-anim", path = "anim"}
|
||||||
|
@ -8,7 +8,7 @@ use common::{
|
|||||||
assets::{self, AssetExt, AssetHandle},
|
assets::{self, AssetExt, AssetHandle},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
@ -49,7 +49,7 @@ use common::{
|
|||||||
assets::{self, AssetExt, AssetHandle},
|
assets::{self, AssetExt, AssetHandle},
|
||||||
terrain::{BiomeKind, SitesKind},
|
terrain::{BiomeKind, SitesKind},
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use rand::{prelude::SliceRandom, thread_rng, Rng};
|
use rand::{prelude::SliceRandom, thread_rng, Rng};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -14,7 +14,7 @@ use common::{
|
|||||||
terrain::TerrainChunk,
|
terrain::TerrainChunk,
|
||||||
vol::{ReadVol, RectRasterableVol},
|
vol::{ReadVol, RectRasterableVol},
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -13,7 +13,7 @@ use common::{
|
|||||||
terrain::TerrainChunk,
|
terrain::TerrainChunk,
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -17,7 +17,7 @@ use common::{
|
|||||||
terrain::TerrainChunk,
|
terrain::TerrainChunk,
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -5,7 +5,7 @@ mod movement;
|
|||||||
|
|
||||||
use client::Client;
|
use client::Client;
|
||||||
use common::terrain::TerrainChunk;
|
use common::terrain::TerrainChunk;
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
|
|
||||||
use block::BlockEventMapper;
|
use block::BlockEventMapper;
|
||||||
use campfire::CampfireEventMapper;
|
use campfire::CampfireEventMapper;
|
||||||
|
@ -14,7 +14,7 @@ use common::{
|
|||||||
terrain::{BlockKind, TerrainChunk},
|
terrain::{BlockKind, TerrainChunk},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -98,7 +98,7 @@ use common::{
|
|||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
terrain::{BlockKind, TerrainChunk},
|
terrain::{BlockKind, TerrainChunk},
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use event_mapper::SfxEventMapper;
|
use event_mapper::SfxEventMapper;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
|
@ -39,7 +39,7 @@ use common::{
|
|||||||
vol::RectRasterableVol,
|
vol::RectRasterableVol,
|
||||||
};
|
};
|
||||||
use common_base::span;
|
use common_base::span;
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use core::{
|
use core::{
|
||||||
borrow::Borrow,
|
borrow::Borrow,
|
||||||
convert::TryFrom,
|
convert::TryFrom,
|
||||||
|
@ -32,7 +32,7 @@ use common::{
|
|||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
use common_base::span;
|
use common_base::span;
|
||||||
use common_sys::state::State;
|
use common_state::State;
|
||||||
use comp::item::Reagent;
|
use comp::item::Reagent;
|
||||||
use num::traits::{Float, FloatConst};
|
use num::traits::{Float, FloatConst};
|
||||||
use specs::{Entity as EcsEntity, Join, WorldExt};
|
use specs::{Entity as EcsEntity, Join, WorldExt};
|
||||||
|
Loading…
Reference in New Issue
Block a user