From 35e220a14f1af77ad3a707eeb3a60382a1ad0e88 Mon Sep 17 00:00:00 2001 From: brulijam Date: Wed, 19 Jun 2024 21:46:53 +0200 Subject: [PATCH] . --- src/brulijam/lib/tutel.lua | 40 ++++++++++++++++++------------------ src/brulijam/t-fiboMiner.lua | 12 +++++------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/brulijam/lib/tutel.lua b/src/brulijam/lib/tutel.lua index b8f5e88..ff6e094 100644 --- a/src/brulijam/lib/tutel.lua +++ b/src/brulijam/lib/tutel.lua @@ -19,58 +19,58 @@ end --location returning move wrapper --https://www.youtube.com/watch?v=bZe5J8SVCYQ -local function forward(x, y, z, rotation) +local function forward(x, y, z, r) if turtle.forward() then - if rotation == 0 then + if r == 0 then z = z + 1 - elseif rotation == 1 then + elseif r == 1 then x = x - 1 - elseif rotation == 2 then + elseif r == 2 then z = z - 1 else x = x + 1 end end - return x,y,z,rotation + return x,y,z,r end -local function back(x, y, z, rotation) +local function back(x, y, z, r) if turtle.back() then - if rotation == 0 then + if r == 0 then z = z - 1 - elseif rotation == 1 then + elseif r == 1 then x = x + 1 - elseif rotation == 2 then + elseif r == 2 then z = z + 1 else x = x - 1 end end - return x,y,z,rotation + return x,y,z,r end -local function up(x, y, z, rotation) +local function up(y) if turtle.up() then y = y + 1 end - return x,y,z,rotation + return y end -local function down(x, y, z, rotation) +local function down(y) if turtle.down() then y = y - 1 end - return x,y,z,rotation + return y end -local function left() - rotation = (rotation-1) % 4 - return x,y,z,rotation +local function left(r) + r = (r-1) % 4 + return r end -local function right() - rotation = (rotation+1) % 4 - return x,y,z,rotation +local function right(r) + r = (r+1) % 4 + return r end diff --git a/src/brulijam/t-fiboMiner.lua b/src/brulijam/t-fiboMiner.lua index ce77295..c53b843 100644 --- a/src/brulijam/t-fiboMiner.lua +++ b/src/brulijam/t-fiboMiner.lua @@ -309,13 +309,13 @@ else startY = read() write("z: ") startZ = read() - write("rotation (S=0,W=1,N=2,E=3):") - rotation = read() + write("r (S=0,W=1,N=2,E=3):") + startR = read() - turtleState["posX"] = startX - turtleState["posY"] = startY - turtleState["posZ"] = startZ - turtleState["rotation"] = rotation + turtleState["x"] = startX + turtleState["y"] = startY + turtleState["z"] = startZ + turtleState["r"] = startR turtleState["startX"] = startX turtleState["startY"] = startY