Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---Variables
- diskdrive = 4
- floppy = 5
- turtleslot = 1
- fuel = 3
- loot = 2
- ---------------------
- rednet.open("left")
- turtle.select(1)
- print("Slots: ","Turtle1","Loot2", "Fuel3", "Diskdrive4", "Floppy5" )
- print("Voer het aantal turtles in: ")
- turtles = read()
- restturtle = turtles
- turtleID = turtles
- print("Voer de maximale afstand in: ")
- maxdis = read()
- print("Welke hoogte wil je beginnen?")
- depth = read()
- function movetodepth()
- startheight = 1
- local blok,type = turtle.inspectDown()
- while type.name ~= ("minecraft:bedrock") do
- turtle.digDown()
- turtle.down()
- startheight = startheight + 1
- blok,type = turtle.inspectDown()
- end
- print("Arrived at bedrock")
- print("Startheight is: ", startheight)
- diepte = 0
- for d = 0,depth do
- turtle.digUp()
- turtle.up()
- end
- print("Arrived at depth")
- for v = 6, 16 do
- turtle.select(v)
- turtle.drop()
- end
- turtle.select(1)
- end
- function movefromdepth()
- upheight = startheight - depth
- for i = 1, startheight do
- turtle.up()
- end
- end
- function diskplaats()
- if turtle.detectDown() then
- turtle.up()
- end
- select(diskdrive)
- if not turtle.detectDown() then
- turtle.select(diskdrive)
- turtle.placeDown()
- end
- turtle.select(floppy)
- turtle.dropDown()
- if turtle.detect() then
- turtle.dig()
- end
- end
- function turtleplaats()
- turtle.select(turtleslot)
- turtle.forward()
- turtle.digUp()
- turtle.placeUp()
- turtle.digDown()
- for i = 1, turtles do
- while turtle.detectDown() do
- sleep(0.2)
- turtle.detectDown()
- print("Waiting for turtle ",turtleID," to leave")
- end
- turtle.select(1)
- turtle.suckUp(1)
- turtle.placeDown()
- turtle.select(loot)
- turtle.dropDown(1)
- turtle.select(fuel)
- turtle.dropDown(1)
- peripheral.call("bottom",'turnOn')
- sleep(1.5)
- rednet.open("left")
- rednet.broadcast(turtleID, maxdis)
- turtleID = turtleID - 1
- end
- end
- function finalturtlewait()
- while not redstone.getInput("bottom") do
- print("Waiting for go from final turtle")
- sleep(1)
- end
- end
- function zooiruimen()
- print("Alle slaven losgelaten, even opruimen")
- turtle.select(1)
- turtle.digUp()
- turtle.back()
- turtle.select(5)
- turtle.suckDown()
- turtle.select(4)
- turtle.digDown()
- turtle.down()
- end
- movetodepth()
- diskplaats()
- turtleplaats()
- finalturtlewait()
- rednet.broadcast("go")
- zooiruimen()
- while true do
- print("Druk op A om de turtles terug te laten keren")
- local event,key = os.pullEvent("key")
- if key == keys.a then
- turtle.select(turtleslot)
- turtle.digUp()
- turtle.placeUp()
- while true do
- print("De turtles komen terug")
- rednet.broadcast("comeback")
- if restturtle == 0 then
- turtle.digUp()
- movefromdepth()
- error("Alle turtles zijn geruimd, einde programma")
- end
- if turtle.detect() then
- turtle.select(loot)
- turtle.suck()
- turtle.select(fuel)
- turtle.suck()
- turtle.select(turtleslot)
- turtle.dig()
- turtle.dropUp()
- restturtle = restturtle - 1
- print("Resterende turtles: ", restturtle)
- end
- sleep(0.5)
- end
- end
- print("De turtles laten minen")
- rednet.broadcast("go")
- sleep(2)
- end
Add Comment
Please, Sign In to add comment