1
Fork 0

let goto break blocks

This commit is contained in:
Andy Killorin 2023-12-20 01:29:44 -06:00
parent 69e7d20df1
commit 292fa13c14
Signed by: ank
GPG key ID: B6241CA3B552BCA4
3 changed files with 15 additions and 9 deletions

View file

@ -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,

View file

@ -169,9 +169,11 @@ async fn dig(
Json(req): Json<Vec3>,
) -> &'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
}
);

View file

@ -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<TurtleCommand> = 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;