Fix turning off worldgen feature

This commit is contained in:
Imbris 2020-11-24 23:55:44 -05:00
parent d1a9264a99
commit c0a8422a43
2 changed files with 8 additions and 1 deletions

View File

@ -362,7 +362,10 @@ impl Server {
let connection_handler = ConnectionHandler::new(network); let connection_handler = ConnectionHandler::new(network);
// Initiate real-time world simulation // Initiate real-time world simulation
#[cfg(feature = "worldgen")]
rtsim::init(&mut state, &world); rtsim::init(&mut state, &world);
#[cfg(not(feature = "worldgen"))]
rtsim::init(&mut state);
let this = Self { let this = Self {
state, state,
@ -503,6 +506,7 @@ impl Server {
dt, dt,
|dispatcher_builder| { |dispatcher_builder| {
sys::add_server_systems(dispatcher_builder); sys::add_server_systems(dispatcher_builder);
#[cfg(feature = "worldgen")]
rtsim::add_server_systems(dispatcher_builder); rtsim::add_server_systems(dispatcher_builder);
}, },
false, false,

View File

@ -82,8 +82,11 @@ pub fn add_server_systems(dispatch_builder: &mut DispatcherBuilder) {
dispatch_builder.add(tick::Sys, TICK_SYS, &[LOAD_CHUNK_SYS, UNLOAD_CHUNK_SYS]); dispatch_builder.add(tick::Sys, TICK_SYS, &[LOAD_CHUNK_SYS, UNLOAD_CHUNK_SYS]);
} }
pub fn init(state: &mut State, world: &world::World) { pub fn init(state: &mut State, #[cfg(feature = "worldgen")] world: &world::World) {
#[cfg(feature = "worldgen")]
let mut rtsim = RtSim::new(world.sim().get_size()); let mut rtsim = RtSim::new(world.sim().get_size());
#[cfg(not(feature = "worldgen"))]
let mut rtsim = RtSim::new(Vec2::new(40, 40));
for _ in 0..2500 { for _ in 0..2500 {
let pos = rtsim let pos = rtsim