include origin into system name

This commit is contained in:
Marcel Märtens 2021-04-07 01:20:26 +02:00
parent 425063e24e
commit 485a477503
3 changed files with 16 additions and 3 deletions

View File

@ -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])

View File

@ -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::<interpolation::Sys>(dispatch_builder, &[]);
dispatch::<mount::Sys>(dispatch_builder, &[]);
dispatch::<controller::Sys>(dispatch_builder, &[&mount::Sys::sys_name()]);

View File

@ -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<persistence::Sys>;
pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) {
dispatch::<melee::Sys>(dispatch_builder, &[&projectile::Sys::sys_name()]);
dispatch::<agent::Sys>(dispatch_builder, &[&interpolation::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, &[]);
dispatch::<invite_timeout::Sys>(dispatch_builder, &[]);