.
This commit is contained in:
parent
33f7597e6a
commit
35e220a14f
@ -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
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user