Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- heading = 1
- pos = vector.new(0,0,0)
- tgted = false
- tgt = vector.new(0,0,0)
- itmQ = 0
- waypoints = {}
- waypoints['dockUnl'] = vector.new(-2,0,2)
- waypoints['unload'] = vector.new(-2,0,1)
- function moveToTgt()
- if pos.x > tgt.x then
- end
- end
- function move(Int, Bool)
- if (Int == 1) then
- end
- end
- function rotB(Bool)
- if Bool then
- turtle.turnRight()
- heading = heading + 1
- else
- turtle.turnLeft()
- heading = heading - 1
- end
- if heading > 4 then
- heading = 1
- elseif heading < 1 then
- heading = 4
- end
- end
- function rot(Int)
- while Int ~= heading do
- turtle.turnRight()
- heading = heading + 1
- if heading > 4 then
- heading = 1
- elseif heading < 1 then
- heading = 4
- end
- end
- end
- function swapBool(Bool)
- if Bool then
- return false
- else
- return true
- end
- end
- function chngCoord(Int)
- if Int == 1 then
- pos.z = pos.z + 1
- elseif Int == 2 then
- pos.x = pos.x + 1
- elseif Int == 3 then
- pos.z = pos.z - 1
- elseif Int == 4 then
- pos.x = pos.x - 1
- elseif Int == 5 then
- pos.y = pos.y - 1
- elseif Int == 6 then
- pos.y = pos.y + 1
- end
- end
- function ChkFuel()
- if turtle.getFuelLevel() == 0 then
- turtle.select(1)
- if turtle.refuel(1) == true then
- print('Dozapravke na ',pos.x, "x",pos.y, "x",pos.z)
- end
- end
- end
- function Fwd(Int)
- for a = 1, Int do
- turtle.dig()
- ChkFuel()
- turtle.forward()
- chngCoord(heading)
- print('moving ',pos.x, "x",pos.y, "x",pos.z)
- end
- end
- function Turn(Bool)
- if Bool then
- rotB(true)
- Fwd(1)
- rotB(true)
- return false
- else
- rotB(false)
- Fwd(1)
- rotB(false)
- return true
- end
- end
- function down()
- turtle.digDown()
- turtle.down()
- chngCoord(5)
- rotB(false)
- rotB(false)
- end
- print('Vvedite Shiriny')
- mX = tonumber(read())
- print('Vvedite glubinu')
- mY = tonumber(read())
- print(' Starting at ',pos.x, "x",pos.y, "x",pos.z)
- Fwd(1)
- rotB(false)
- Fwd(mX/2)
- rotB(true)
- for c=1, 2 do
- turtle.digUp()
- turtle.up()
- chngCoord(6)
- end
- print(' Dig down at ',pos.x, "x",pos.y, "x",pos.z)
- turn = true
- for y = 1, mY+3 do
- if y > 1 then
- down()
- end
- for x = 1, mX do
- if mX > 1 then
- Fwd(mX - 1)
- else
- Fwd(mX)
- end
- if x ~= mX then
- turn = Turn(turn)
- end
- end
- end
- print('Begin dig up, steps up = ', mY, "\n ", pos.x, "x",pos.y, "x",pos.z)
- for b=1, mY do
- turtle.digUp()
- turtle.up()
- chngCoord(6)
- end
- print('Ending operation ', pos.x, "x",pos.y, "x",pos.z)
Advertisement
Add Comment
Please, Sign In to add comment