diff --git a/Cargo.toml b/Cargo.toml index 533a0add9c..437f7f5e71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,9 @@ +[package] +name = "veloren" +description = "Veloren is an open-world, open-source multiplayer voxel RPG." +documentation = "https://docs.veloren.net" +repository = "https://www.gitlab.com/veloren/veloren" + [workspace] members = [ "common", diff --git a/client/src/lib.rs b/client/src/lib.rs index 1d5bdc1a00..c98a01b746 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -144,6 +144,10 @@ impl Client { // Handle new messages from the server frontend_events.append(&mut self.handle_new_messages()?); + self.state.terrain().iter().for_each(|(k, _)| { + println!("Chunk at {:?}", k); + }); + // Step 1 if let Some(ecs_entity) = self.player { // TODO: remove this diff --git a/common/src/volumes/vol_map.rs b/common/src/volumes/vol_map.rs index 507c009aea..fcf45d32cd 100644 --- a/common/src/volumes/vol_map.rs +++ b/common/src/volumes/vol_map.rs @@ -141,4 +141,22 @@ impl VolMap { pub fn pos_key(&self, pos: Vec3) -> Vec3 { Self::chunk_key(pos) } + + pub fn iter<'a>(&'a self) -> ChunkIter<'a, V, S, M> { + ChunkIter { + iter: self.chunks.iter(), + } + } +} + +pub struct ChunkIter<'a, V: Vox, S: VolSize, M> { + iter: std::collections::hash_map::Iter<'a, Vec3, Chunk>, +} + +impl<'a, V: Vox, S: VolSize, M> Iterator for ChunkIter<'a, V, S, M> { + type Item = (Vec3, &'a Chunk); + + fn next(&mut self) -> Option { + self.iter.next().map(|(k, c)| (*k, c)) + } }