Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hOst = false
- hDown = false
- hNord = true
- pos = vector.new(0,0,0)
- function swapBool(Bool)
- if Bool then
- return false
- else
- return true
- end
- end
- function chngHBool(Int)
- if Int == 1 then
- hOst = swapBool(hOst)
- elseif Int == 2 then
- hDown = swapBool(hDown)
- else
- hNord = swapBool(hNord)
- end
- end
- function chngCoord(Int)
- if Int == 1 then
- if hOst then
- pos.x = pos.x + 1
- else
- pos.x = pos.x - 1
- end
- elseif Int == 2 then
- if hDown then
- pos.y = pos.y - 1
- else
- pos.y = pos.y + 1
- end
- else
- if hNord then
- pos.z = pos.z + 1
- else
- pos.z = pos.z - 1
- end
- 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, Bool)
- for a = 1, Int do
- turtle.dig()
- ChkFuel()
- turtle.forward()
- if Bool then
- chngCoord(3)
- else
- chngCoord(1)
- end
- print('moving ',pos.x, "x",pos.y, "x",pos.z)
- end
- end
- function Turn(Bool)
- if Bool then
- turtle.turnRight()
- Fwd(1,false)
- turtle.turnRight()
- chngHBool(3)
- return false
- else
- turtle.turnLeft()
- Fwd(1,false)
- turtle.turnLeft()
- chngHBool(3)
- return true
- end
- end
- function down()
- turtle.digDown()
- turtle.down()
- chngCoord(2)
- turtle.turnLeft()
- turtle.turnLeft()
- chngHBool(3)
- chngHBool(1)
- 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,true)
- turtle.turnLeft()
- Fwd(mX/2,false)
- chngHBool(1)
- turtle.turnRight()
- for c=1, 2 do
- turtle.digUp()
- turtle.up()
- chngCoord(2)
- end
- chngHBool(2)
- 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,true)
- else
- Fwd(mX,true)
- end
- if x ~= mX then
- turn = Turn(turn)
- end
- end
- end
- print('Begin dig up, steps up = ', mY + 3, "\n ", pos.x, "x",pos.y, "x",pos.z)
- chngHBool(2)
- for b=1, mY do
- turtle.digUp()
- turtle.up()
- chngCoord(2)
- end
- print('Ending operation ', pos.x, "x",pos.y, "x",pos.z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement