Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- local xPos, yPos, zPos = nil
- local heading = 1
- local xSet,ySet,zSet = nil
- local distance = nil
- local blockplacecounter = nil
- local selectedslot = 1
- local Aktuellx,Aktuelly,Aktuellz = nil
- local durchgaenge = 0
- local block_mine_counter = 0
- local Startx,Starty,Startz = nil
- --id,message = rednet.receive()
- --Steuercode
- --bedrockmining()
- --if message == "ebnen" then
- -- gebiet_ebnen()
- --end
- --if message == "bedrock" then
- -- bedrock_mining()
- --end
- --functions
- function getPosition()
- xPos, yPos, zPos = gps.locate()
- return xPos,yPos,zPos
- end
- function setPosition()
- xSet,ySet,zSet=getPosition()
- end
- function getHeading()
- x1,y1,z1=getPosition()
- forward()
- forward()
- x2,y2,z2=getPosition()
- back()
- back()
- left()
- forward()
- forward()
- x3,y3,z3=getPosition()
- back()
- back()
- right()
- if (x2-x1)>=-1 then
- heading=1
- elseif (x2-x1)>=1 then
- heading=3
- elseif (z3-z1)>=1 then
- heading=0
- elseif (z3-z1)>=-1 then
- heading=2
- end
- while not(heading==1) do
- right()
- end
- end
- function setworkArea(blocks)
- distance = blocks
- end
- function forward()
- turtle.forward()
- end
- function down()
- turtle.down()
- Aktuellz = Aktuellz -1
- end
- function up()
- turtle.up()
- Aktuellz = Aktuellz +1
- end
- function Slotleer()
- if blockplacecounter == 64 then
- turtle.select(selectedslot+1)
- selectedslot = selectedslot +1
- blockplacecounter = 0
- end
- end
- function right()
- if heading==1 then
- heading = 2
- elseif heading == 2 then
- heading = 3
- elseif heading == 3 then
- heading = 0
- elseif heading == 0 then
- heading = 1
- end
- turtle.turnRight()
- end
- function left()
- if heading == 1 then
- heading = 0
- elseif heading == 0 then
- heading= 3
- elseif heading == 3 then
- heading = 2
- elseif heading == 2 then
- heading = 1
- end
- turtle.turnLeft()
- end
- function back()
- turtle.back()
- end
- function dig()
- turtle.dig()
- end
- function digDown()
- turtle.digDown()
- end
- function digUp()
- turtle.digUp()
- end
- function placeUnder()
- turtle.placeDown()
- if blockplacecounter == nil then
- blockplacecounter = 1
- end
- blockplacecounter = blockplacecounter +1
- end
- function detectDown()
- detectionDown = turtle.detectDown()
- return detectionDown
- end
- function detect()
- detectionFront = turtle.detect()
- return detectionFront
- end
- function compareTo()
- comparision = turtle.compareTo(2)
- return comparision
- end
- function block_unten_ersetzen()
- if detectDown() then
- digDown()
- placeUnder()
- else
- placeUnder()
- end
- end
- function block_vorne_entfernen()
- if detect() then
- dig()
- end
- end
- --
- --function bedrockmining()
- Startx,Starty,Startz = getPosition()
- --Aktuellx,Aktuelly,Aktuellz = getPosition()
- --Aktuellx,Aktuelly,Aktuellz = Startx,Starty,Startz
- durchgaenge=0
- while not(message=="end") do
- --runter auf level 12
- if not(Aktuellz==12) then
- while (Aktuellz>=12) do
- Aktuellx,Aktuelly, Aktuellz = getPosition()
- if turtle.detectDown() then
- digDown()
- down()
- else
- down()
- end
- end
- end
- --Auf Ebene 12 minen
- block_mine_counter = 0
- while block_mine_counter <=20 do
- --block_vorne_entfernen()
- if (turtle.detect()) then
- dig()
- forward()
- end
- if not (turtle.detect()) then
- forward()
- end
- block_mine_counter = block_mine_counter +1
- end
- right()
- block_vorne_entfernen()
- forward()
- block_vorne_entfernen()
- forward()
- right()
- block_mine_counter = 0
- durchgaenge=durchgaenge +1
- if durchgaenge == 3 then
- while not(Aktuellz==Startz) do
- digUp()
- up()
- end
- end
- end
- --end
- --
- function gebiet_ebnen()
- setPosition()
- setworkArea(15)
- --getHeading()
- --
- while not (message=="end") do
- --Position bestimmen
- x,y,z =getPosition()
- --Ende Position
- if (z>=zSet-distance) and (z<=zSet+distance) then
- Slotleer()
- if heading == 1 then
- if x >= (xSet-distance) then
- block_unten_ersetzen()
- block_vorne_entfernen()
- forward()
- else
- left()
- block_unten_ersetzen()
- block_vorne_entfernen()
- forward()
- left()
- end
- end
- if heading == 3 then
- if x<= (xSet) then
- block_unten_ersetzen()
- block_vorne_entfernen()
- forward()
- else
- right()
- block_unten_ersetzen()
- block_vorne_entfernen()
- forward()
- right()
- end
- end
- end
- --if not (turtle.compareTo(2)) and turtle.detect() then
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement