.
This commit is contained in:
parent
33f7597e6a
commit
35e220a14f
@ -19,58 +19,58 @@ end
|
|||||||
|
|
||||||
--location returning move wrapper
|
--location returning move wrapper
|
||||||
--https://www.youtube.com/watch?v=bZe5J8SVCYQ
|
--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 turtle.forward() then
|
||||||
if rotation == 0 then
|
if r == 0 then
|
||||||
z = z + 1
|
z = z + 1
|
||||||
elseif rotation == 1 then
|
elseif r == 1 then
|
||||||
x = x - 1
|
x = x - 1
|
||||||
elseif rotation == 2 then
|
elseif r == 2 then
|
||||||
z = z - 1
|
z = z - 1
|
||||||
else
|
else
|
||||||
x = x + 1
|
x = x + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return x,y,z,rotation
|
return x,y,z,r
|
||||||
end
|
end
|
||||||
|
|
||||||
local function back(x, y, z, rotation)
|
local function back(x, y, z, r)
|
||||||
if turtle.back() then
|
if turtle.back() then
|
||||||
if rotation == 0 then
|
if r == 0 then
|
||||||
z = z - 1
|
z = z - 1
|
||||||
elseif rotation == 1 then
|
elseif r == 1 then
|
||||||
x = x + 1
|
x = x + 1
|
||||||
elseif rotation == 2 then
|
elseif r == 2 then
|
||||||
z = z + 1
|
z = z + 1
|
||||||
else
|
else
|
||||||
x = x - 1
|
x = x - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return x,y,z,rotation
|
return x,y,z,r
|
||||||
end
|
end
|
||||||
|
|
||||||
local function up(x, y, z, rotation)
|
local function up(y)
|
||||||
if turtle.up() then
|
if turtle.up() then
|
||||||
y = y + 1
|
y = y + 1
|
||||||
end
|
end
|
||||||
return x,y,z,rotation
|
return y
|
||||||
end
|
end
|
||||||
|
|
||||||
local function down(x, y, z, rotation)
|
local function down(y)
|
||||||
if turtle.down() then
|
if turtle.down() then
|
||||||
y = y - 1
|
y = y - 1
|
||||||
end
|
end
|
||||||
return x,y,z,rotation
|
return y
|
||||||
end
|
end
|
||||||
|
|
||||||
local function left()
|
local function left(r)
|
||||||
rotation = (rotation-1) % 4
|
r = (r-1) % 4
|
||||||
return x,y,z,rotation
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
local function right()
|
local function right(r)
|
||||||
rotation = (rotation+1) % 4
|
r = (r+1) % 4
|
||||||
return x,y,z,rotation
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,13 +309,13 @@ else
|
|||||||
startY = read()
|
startY = read()
|
||||||
write("z: ")
|
write("z: ")
|
||||||
startZ = read()
|
startZ = read()
|
||||||
write("rotation (S=0,W=1,N=2,E=3):")
|
write("r (S=0,W=1,N=2,E=3):")
|
||||||
rotation = read()
|
startR = read()
|
||||||
|
|
||||||
turtleState["posX"] = startX
|
turtleState["x"] = startX
|
||||||
turtleState["posY"] = startY
|
turtleState["y"] = startY
|
||||||
turtleState["posZ"] = startZ
|
turtleState["z"] = startZ
|
||||||
turtleState["rotation"] = rotation
|
turtleState["r"] = startR
|
||||||
|
|
||||||
turtleState["startX"] = startX
|
turtleState["startX"] = startX
|
||||||
turtleState["startY"] = startY
|
turtleState["startY"] = startY
|
||||||
|
Loading…
Reference in New Issue
Block a user