diff --git a/.cargo/config b/.cargo/config index 024104445e..4407be603f 100644 --- a/.cargo/config +++ b/.cargo/config @@ -6,10 +6,10 @@ rustflags = [ [alias] csv-export = "run --manifest-path common/Cargo.toml --features=bin_csv --bin csv_export" csv-import = "run --manifest-path common/Cargo.toml --features=bin_csv --bin csv_import" -test-server = "-Zpackage-features run --bin veloren-server-cli --no-default-features -- -b" -tracy-server = "-Zunstable-options -Zpackage-features run --bin veloren-server-cli --no-default-features --features tracy,simd --profile no_overflow" -tracy-world-server = "-Zunstable-options -Zpackage-features run --bin veloren-server-cli --features tracy,simd --profile no_overflow -- -b" -test-voxygen = "-Zpackage-features run --bin veloren-voxygen --no-default-features --features gl,simd" -tracy-voxygen = "-Zunstable-options -Zpackage-features run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile no_overflow" +test-server = "run --bin veloren-server-cli --no-default-features -- -b" +tracy-server = "-Zunstable-options run --bin veloren-server-cli --no-default-features --features tracy,simd --profile no_overflow" +tracy-world-server = "-Zunstable-options run --bin veloren-server-cli --features tracy,simd --profile no_overflow -- -b" +test-voxygen = "run --bin veloren-voxygen --no-default-features --features gl,simd" +tracy-voxygen = "-Zunstable-options run --bin veloren-voxygen --no-default-features --features tracy,gl,simd --profile no_overflow" server = "run --bin veloren-server-cli" diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index 778978ee45..39dbe97a9f 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -248,6 +248,7 @@ fn main() -> io::Result<()> { server.remove_admin(&username); }, Message::LoadArea(view_distance) => { + #[cfg(feature = "worldgen")] server.create_centered_persister(view_distance); }, Message::SetSqlLogMode(sql_log_mode) => { diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 083b00ba4b..29603283b7 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -516,6 +516,7 @@ fn handle_site( args: String, action: &ChatCommand, ) -> CmdResult<()> { + #[cfg(feature = "worldgen")] if let Ok(dest_name) = scan_fmt!(&args, &action.arg_fmt(), String) { let site = server .world @@ -538,6 +539,9 @@ fn handle_site( } else { Err(action.help_string()) } + + #[cfg(not(feature = "worldgen"))] + Ok(()) } fn handle_home( diff --git a/server/src/events/information.rs b/server/src/events/information.rs index b6e650c578..490fe2ba44 100644 --- a/server/src/events/information.rs +++ b/server/src/events/information.rs @@ -12,6 +12,8 @@ pub fn handle_site_info(server: &Server, entity: EcsEntity, id: u64) { labor_values: HashMap::new(), values: HashMap::new(), labors: Vec::new(), + last_exports: HashMap::new(), + resources: HashMap::new(), }; let msg = ServerGeneral::SiteEconomy(info); server diff --git a/server/src/events/invite.rs b/server/src/events/invite.rs index 7df7dd20af..1a444f60fe 100644 --- a/server/src/events/invite.rs +++ b/server/src/events/invite.rs @@ -223,6 +223,7 @@ pub fn handle_invite_accept(server: &mut Server, entity: specs::Entity) { .inbox .push_front(AgentEvent::TradeAccepted(invitee_uid)); } + #[cfg(feature = "worldgen")] let pricing = agents .get(inviter) .and_then(|a| { @@ -237,6 +238,9 @@ pub fn handle_invite_accept(server: &mut Server, entity: specs::Entity) { .and_then(|id| index.get_site_prices(id)) }) }); + #[cfg(not(feature = "worldgen"))] + let pricing = None; + clients.get(inviter).map(|c| { c.send(ServerGeneral::UpdatePendingTrade( id, diff --git a/server/src/events/trade.rs b/server/src/events/trade.rs index f00d031700..125a5875e7 100644 --- a/server/src/events/trade.rs +++ b/server/src/events/trade.rs @@ -118,12 +118,15 @@ pub fn handle_process_trade_action( .map(|i| ReducedInventory::from(i)); // Get price info from the first Agent in the trade (currently, an // Agent will never initiate a trade with another agent though) - prices = prices.or_else(|| { - agents - .get(e) - .and_then(|a| a.behavior.trade_site) - .and_then(|id| server.index.get_site_prices(id)) - }); + #[cfg(feature = "worldgen")] + { + prices = prices.or_else(|| { + agents + .get(e) + .and_then(|a| a.behavior.trade_site) + .and_then(|id| server.index.get_site_prices(id)) + }); + } } } drop(agents); @@ -137,6 +140,7 @@ pub fn handle_process_trade_action( prices.clone(), ), ); + #[cfg(feature = "worldgen")] notify_agent_prices( server.state.ecs().write_storage::(), &server.index, diff --git a/server/src/lib.rs b/server/src/lib.rs index 7766160edf..f14848d3ce 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -337,15 +337,21 @@ impl Server { // Insert a default AABB for the world // TODO: prevent this from being deleted { - let mut build_areas = state.ecs().write_resource::(); - let world_size = world.sim().get_size().map(|e| e as i32) - * TerrainChunk::RECT_SIZE.map(|e| e as i32); + #[cfg(feature = "worldgen")] + let size = world.sim().get_size(); + #[cfg(not(feature = "worldgen"))] + let size = Vec2::new(40, 40); + + let world_size = size.map(|e| e as i32) * TerrainChunk::RECT_SIZE.map(|e| e as i32); let world_aabb = Aabb { min: Vec3::new(0, 0, -32768), max: Vec3::new(world_size.x, world_size.y, 32767), } .made_valid(); - build_areas + + state + .ecs() + .write_resource::() .insert("world".to_string(), world_aabb) .expect("The initial insert should always work."); } @@ -1092,6 +1098,7 @@ impl Server { /// view_distance: distance in chunks that are persisted, this acts like the /// player view distance so it is actually a bit farther due to a buffer /// zone + #[cfg(feature = "worldgen")] pub fn create_centered_persister(&mut self, view_distance: u32) { let world_dims_chunks = self.world.sim().get_size(); let world_dims_blocks = TerrainChunkSize::blocks(world_dims_chunks); diff --git a/server/src/rtsim/mod.rs b/server/src/rtsim/mod.rs index eb5ebc5068..3a08bb55ff 100644 --- a/server/src/rtsim/mod.rs +++ b/server/src/rtsim/mod.rs @@ -104,6 +104,7 @@ pub fn init(state: &mut State, #[cfg(feature = "worldgen")] world: &world::World #[cfg(not(feature = "worldgen"))] let mut rtsim = RtSim::new(Vec2::new(40, 40)); + #[cfg(feature = "worldgen")] for _ in 0..world.sim().get_size().product() / 400 { let pos = rtsim .chunks diff --git a/server/src/state_ext.rs b/server/src/state_ext.rs index 94ecf14b4f..76cbddd317 100644 --- a/server/src/state_ext.rs +++ b/server/src/state_ext.rs @@ -352,7 +352,10 @@ impl StateExt for State { * TerrainChunkSize::RECT_SIZE.x as f64 }) .for_each(|chunk_key| { - chunk_generator.generate_chunk(None, chunk_key, &slow_jobs, Arc::clone(world), index.clone()); + #[cfg(feature = "worldgen")] + { + chunk_generator.generate_chunk(None, chunk_key, &slow_jobs, Arc::clone(world), index.clone()); + } }); } diff --git a/server/src/sys/agent.rs b/server/src/sys/agent.rs index 2d2e633fa7..dda1368df2 100644 --- a/server/src/sys/agent.rs +++ b/server/src/sys/agent.rs @@ -95,6 +95,7 @@ pub struct ReadData<'a> { mount_states: ReadStorage<'a, MountState>, time_of_day: Read<'a, TimeOfDay>, light_emitter: ReadStorage<'a, LightEmitter>, + #[cfg(feature = "worldgen")] world: ReadExpect<'a, Arc>, rtsim_entities: ReadStorage<'a, RtSimEntity>, buffs: ReadStorage<'a, Buffs>, @@ -761,12 +762,15 @@ impl<'a> AgentData<'a> { let mut ground_too_close = self .body .map(|body| { + #[cfg(feature = "worldgen")] let height_approx = self.pos.0.y - read_data .world .sim() .get_alt_approx(self.pos.0.xy().map(|x: f32| x as i32)) .unwrap_or(0.0); + #[cfg(not(feature = "worldgen"))] + let height_approx = self.pos.0.y; height_approx < body.flying_height() })