use common::{ comp::{ inventory::item::MaterialStatManifest, skills::{GeneralSkill, Skill}, tool::AbilityMap, Auras, Buffs, CharacterActivity, CharacterState, Collider, Combo, Controller, Energy, Health, Ori, Pos, Stats, Vel, }, resources::{DeltaTime, GameMode, Time}, shared_server_config::ServerConstants, skillset_builder::SkillSetBuilder, terrain::{ Block, BlockKind, MapSizeLg, SpriteKind, TerrainChunk, TerrainChunkMeta, TerrainGrid, }, }; use common_ecs::{dispatch, System}; use common_net::sync::WorldSyncExt; use common_state::State; use rand::{prelude::*, rngs::SmallRng}; use specs::{Builder, Entity, WorldExt}; use std::{error::Error, sync::Arc, time::Duration}; use vek::{Rgb, Vec2, Vec3}; use veloren_common_systems::{character_behavior, phys}; pub const EPSILON: f32 = 0.00002; const DT_MILLIS: u64 = 10; const MILLIS_PER_SEC: f64 = 1_000.0; pub const DT: Duration = Duration::from_millis(DT_MILLIS); pub const DT_F64: f64 = DT_MILLIS as f64 / MILLIS_PER_SEC; const DEFAULT_WORLD_CHUNKS_LG: MapSizeLg = if let Ok(map_size_lg) = MapSizeLg::new(Vec2 { x: 10, y: 10 }) { map_size_lg } else { panic!("Default world chunk size does not satisfy required invariants."); }; pub fn setup(add_systems: impl Fn(&mut specs::DispatcherBuilder)) -> State { let pools = State::pools(GameMode::Server); let mut state = State::new( GameMode::Server, pools, DEFAULT_WORLD_CHUNKS_LG, Arc::new(TerrainChunk::water(0)), add_systems, common_state::plugin::PluginMgr::default(), ); state.ecs_mut().insert(MaterialStatManifest::with_empty()); state.ecs_mut().insert(AbilityMap::load().cloned()); state.ecs_mut().read_resource::