diff --git a/client/client.lua b/client/client.lua index b6dcb8c..21c1706 100644 --- a/client/client.lua +++ b/client/client.lua @@ -92,12 +92,12 @@ local commands = { ["Backward"] = cyclefn(turtle.back), ["Up"] = cyclefn(turtle.up), ["Down"] = cyclefn(turtle.down), - ["DropFront"] = turtle.dropfront, - ["DropUp"] = turtle.dropup, - ["DropDown"] = turtle.dropdown, - ["SuckFront"] = turtle.suckfront, - ["SuckUp"] = turtle.suckup, - ["SuckDown"] = turtle.suckdown, + ["DropFront"] = turtle.drop, + ["DropUp"] = turtle.dropUp, + ["DropDown"] = turtle.dropDown, + ["SuckFront"] = turtle.suck, + ["SuckUp"] = turtle.suckUp, + ["SuckDown"] = turtle.suckDown, ["Select"] = turtle.select, ["Refuel"] = turtle.refuel, ["ItemInfo"] = iteminfo, diff --git a/server/src/main.rs b/server/src/main.rs index ae66ec3..9044369 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -169,9 +169,11 @@ async fn dig( Json(req): Json, ) -> &'static str { let turtle = state.read().await.get_turtle(id).await.unwrap(); + let fuel = Position::new(Vec3::new(-19, 93, 73), blocks::Direction::East); + let inventory = Position::new(Vec3::new(-19, 92, 73), blocks::Direction::East); tokio::spawn( async move { - mine::mine_chunk(turtle.clone(), req).await + mine::mine(turtle.clone(), req, fuel, inventory).await } ); diff --git a/server/src/turtle.rs b/server/src/turtle.rs index 25a64ca..96450c7 100644 --- a/server/src/turtle.rs +++ b/server/src/turtle.rs @@ -202,7 +202,7 @@ impl TurtleCommander { } // easiest way to not eventually take over all memory - let routing = timeout(Duration::from_secs(1), route(recent, pos, &world)); + let routing = timeout(Duration::from_secs(2), route(recent, pos, &world)); let route = routing.await.ok()??; let steps: Vec = route.iter().map_windows(|[from,to]| from.difference(**to).unwrap()).collect(); @@ -212,7 +212,11 @@ impl TurtleCommander { // valid routes will explicitly tell you to break ground if world.occupied(next_position.pos).await { - break 'route; + if world.garbage(next_position.pos).await { + self.execute(dbg!(recent.dig(next_position.pos))?).await; + } else { + break 'route; + } } let state = self.execute(command).await;