changed getFinalOffset to include facing

This commit is contained in:
Djeeberjr 2022-04-28 22:54:33 +02:00
parent 1ad78c23bb
commit 5ab1a46840

View File

@ -1,5 +1,6 @@
package lib.turtle;
import util.Pos;
import util.Pos3;
import kernel.turtle.Turtle;
using tink.CoreApi;
@ -36,7 +37,11 @@ class TurtleExecuter {
return blocks;
}
public function getFinalOffset(): Pos3 {
/**
Return the offset of the turtle after executing the instructions.
The origin is the starting position of the turtle.
**/
public function getFinalOffset(): {offset: Pos3, faceing: Pos} {
var pos: Pos3 = {x:0, y:0, z:0};
var forwardVec: Pos3 = {x: 1, y: 0, z: 0};
@ -54,7 +59,7 @@ class TurtleExecuter {
}
}
return pos;
return {offset:pos,faceing: new Pos({x:forwardVec.x, y:forwardVec.z})};
}
public function execute() {