From 96bda5bbded329eb6131611b1cb27da8f895471a Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Thu, 28 Dec 2023 20:56:35 -0600 Subject: [PATCH] pause vein removals to store --- server/src/mine.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/server/src/mine.rs b/server/src/mine.rs index 620cb43..470504c 100644 --- a/server/src/mine.rs +++ b/server/src/mine.rs @@ -584,6 +584,8 @@ impl Remove { next.push(self.start); } + let mut inventory_check = 64; + while let Some(pos) = next.pop() { // skip if seen and unwanted if !self.wanted(&world, pos).await.unwrap_or(true) { @@ -610,9 +612,21 @@ impl Remove { // these will be pruned in the next iterations 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 {