From 5ab1a468400c98ad19a68e804eade03609609510 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Thu, 28 Apr 2022 22:54:33 +0200 Subject: [PATCH] changed getFinalOffset to include facing --- src/lib/turtle/TurtleExecuter.hx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/turtle/TurtleExecuter.hx b/src/lib/turtle/TurtleExecuter.hx index 39271c3..0da5936 100644 --- a/src/lib/turtle/TurtleExecuter.hx +++ b/src/lib/turtle/TurtleExecuter.hx @@ -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() {