Skip to content

Commit

Permalink
parse test chunk distance from config
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Aug 15, 2024
1 parent ceb718d commit 2198382
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pumpkin-world/src/radial_chunk_iterator.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
pub struct RadialIterator {
radius: i32,
radius: u32,
direction: usize,
current: (i32, i32),
step_size: i32,
steps_taken: i32,
steps_taken: u32,
steps_in_direction: i32,
}

impl RadialIterator {
pub fn new(radius: i32) -> Self {
pub fn new(radius: u32) -> Self {
RadialIterator {
radius,
direction: 0,
Expand Down
6 changes: 3 additions & 3 deletions pumpkin/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ impl Server {
)
}

Server::spawn_test_chunk(client).await;
Server::spawn_test_chunk(client, self.base_config.view_distance as u32).await;
}

/// TODO: This definitly should be in world
Expand Down Expand Up @@ -337,7 +337,7 @@ impl Server {
}

// TODO: do this in a world
async fn spawn_test_chunk(client: &mut Client) {
async fn spawn_test_chunk(client: &mut Client, distance: u32) {
let inst = std::time::Instant::now();
let (sender, mut chunk_receiver) = mpsc::channel(1024);
tokio::spawn(async move {
Expand All @@ -346,7 +346,7 @@ impl Server {
"./world".parse().unwrap(),
);
level
.read_chunks(RadialIterator::new(7).collect(), sender)
.read_chunks(RadialIterator::new(distance).collect(), sender)
.await;
});

Expand Down

0 comments on commit 2198382

Please sign in to comment.