let goto break blocks
This commit is contained in:
parent
69e7d20df1
commit
292fa13c14
3 changed files with 15 additions and 9 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue