tunnel command to turtle ctl

This commit is contained in:
Niklas Kapelle 2024-08-05 16:58:46 +02:00
parent 3e993b84eb
commit b05dae958d
Signed by: niklas
GPG Key ID: 4EB651B36D841D16

View File

@ -1,5 +1,6 @@
package bin;
import lib.turtle.Helper;
import kernel.turtle.TurtleMutex;
import kernel.turtle.Turtle;
import lib.turtle.InvManager;
@ -110,6 +111,11 @@ class TurtleCtl extends CLIAppBase {
return Future.sync(false);
}
}, [String("direction")]);
registerAsyncSubcommand("tunnel", (args) -> {
var len = args.getInt("length");
return asynPerform(Helper.combine.bind([Turtle.dig.bind(Front), Turtle.forward, Turtle.dig.bind(Up)]), len);
}, [Int("length")]);
}
private function asynPerform(op:Void->Outcome<Noise, String>, times:Int):Future<Bool> {