From 485a477503b2d7d5e207844e0b0ab18ddec620c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 7 Apr 2021 01:20:26 +0200 Subject: [PATCH] include origin into system name --- common/ecs/src/system.rs | 13 ++++++++++++- common/sys/src/lib.rs | 1 + server/src/sys/mod.rs | 5 +++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/common/ecs/src/system.rs b/common/ecs/src/system.rs index e061582260..73e9ce329a 100644 --- a/common/ecs/src/system.rs +++ b/common/ecs/src/system.rs @@ -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, 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]) diff --git a/common/sys/src/lib.rs b/common/sys/src/lib.rs index 59bc47ff8b..4287507a5a 100644 --- a/common/sys/src/lib.rs +++ b/common/sys/src/lib.rs @@ -19,6 +19,7 @@ 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::(dispatch_builder, &[]); dispatch::(dispatch_builder, &[]); dispatch::(dispatch_builder, &[&mount::Sys::sys_name()]); diff --git a/server/src/sys/mod.rs b/server/src/sys/mod.rs index 141a24b20f..5f1463da08 100644 --- a/server/src/sys/mod.rs +++ b/server/src/sys/mod.rs @@ -12,7 +12,7 @@ pub mod terrain_sync; pub mod waypoint; use common_ecs::{dispatch, run_now, System}; -use common_sys::{interpolation, melee, projectile}; +use common_sys::{melee, projectile}; use specs::DispatcherBuilder; use std::{ marker::PhantomData, @@ -23,7 +23,8 @@ pub type PersistenceScheduler = SysScheduler; pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) { dispatch::(dispatch_builder, &[&projectile::Sys::sys_name()]); - dispatch::(dispatch_builder, &[&interpolation::Sys::sys_name()]); + //Note: server should not depend on interpolation system + dispatch::(dispatch_builder, &[]); dispatch::(dispatch_builder, &[]); dispatch::(dispatch_builder, &[]); dispatch::(dispatch_builder, &[]);