1
Fork 0

pause vein removals to store

This commit is contained in:
Andy Killorin 2023-12-28 20:56:35 -06:00
parent 42c1933780
commit 96bda5bbde
Signed by: ank
GPG key ID: B6241CA3B552BCA4

View file

@ -584,6 +584,8 @@ impl Remove {
next.push(self.start); next.push(self.start);
} }
let mut inventory_check = 64;
while let Some(pos) = next.pop() { while let Some(pos) = next.pop() {
// skip if seen and unwanted // skip if seen and unwanted
if !self.wanted(&world, pos).await.unwrap_or(true) { if !self.wanted(&world, pos).await.unwrap_or(true) {
@ -610,9 +612,21 @@ impl Remove {
// these will be pruned in the next iterations // these will be pruned in the next iterations
next.append(&mut near); next.append(&mut near);
inventory_check -= 1;
if inventory_check == 0 {
inventory_check = 64;
let inventory = turtle.inventory().await;
let full = inventory.iter().filter(|s| s.is_some()).count();
if full > 14 {
turtle.dock().await;
}
}
} }
Some(false) Some(true)
} }
async fn wanted(&self, world: &SharedWorld, pos: Vec3) -> Option<bool> { async fn wanted(&self, world: &SharedWorld, pos: Vec3) -> Option<bool> {