Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- IMPLEMENTED LATER
- local maxDistance = 100 -- the amount of blocks the turtle can move away from its first position X,Y not
- -- pastebin get S67j7heg colony
- -- use maxDistance if you wanna limit turtle to only move in a certain area
- local position = {0,0,0} -- X is forward based on turtles original orientation
- local orientation = 1 -- forward,right,backward,left
- local currentItemDetail = {name="hello",count=1}
- local currentFuel = 0
- local desiredFuel = 800
- -- 1 coal = 80 fuel
- -- 1 fuel = 1 move block
- function turnRight()
- turtle.turnRight()
- orientation=orientation+1
- if orientation >4 then orientation = 1 end
- end
- function turnLeft()
- turtle.turnLeft()
- orientation=orientation-1
- if orientation <1 then orientation = 4 end
- end
- function turn(direction)
- while orientation~=direction do turnRight() end
- end
- function getFromChest(name)
- turtle.drop()
- local adsa,asdasd = turtle.suck()
- repeat
- adsa,asdasd = turtle.suck()
- currentItemDetail = turtle.getItemDetail()
- if currentItemDetail and currentItemDetail.name==name then
- return
- else
- turtle.dropUp()
- end
- until adsa==false
- repeat
- adsa,asdasd = turtle.suckUp()
- turtle.drop()
- until adsa==false
- end
- function forward()
- turtle.select(4)
- turtle.dig("right")
- turtle.dropDown()
- turtle.forward()
- if orientation==1 then
- position[1]=position[1]+1
- elseif orientation==2 then
- position[3]=position[3]+1
- elseif orientation==3 then
- position[1]=position[1]-1
- elseif orientation==4 then
- position[3]=position[3]-1
- end
- turtle.select(1)
- end
- function dropAll()
- for i=1,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(1)
- end
- function digMove(direction)
- if direction=="up" then
- turtle.digUp()
- turtle.up()
- position[2]=position[2]+1
- elseif direction=="down" then
- turtle.digDown()
- turtle.down()
- position[2]=position[2]-1
- else
- turn(direction)
- turtle.dig("right")
- forward()
- end
- end
- print("Turtle Self-replication")
- print("Please insert 10 coal into slot")
- turtle.turnRight()
- -- wait for user to input fuel
- while currentFuel < desiredFuel do
- turtle.refuel(desiredFuel/80)
- currentFuel = turtle.getFuelLevel()
- print("Fuel : "..currentFuel.." / "..desiredFuel)
- sleep(1)
- end
- print("done insert fuel, remove any items in slot")
- -- walk forward to disperse
- for i=1,5 do
- forward()
- sleep(0)
- position={0,0,0}
- end
- -- get a chest for craft organization
- print("Need a chest in selected slot ONLY 1")
- repeat
- currentItemDetail = turtle.getItemDetail()
- sleep(1)
- until currentItemDetail and currentItemDetail.name == "minecraft:chest" and currentItemDetail.count == 1
- print("Setting up base... Digging down 8 blocks to make furnace.. make sure to check that below block is stone")
- turtle.place() -- place chest
- sleep(1)
- -- dig until 8 cobblestone
- repeat
- digMove("down")
- currentItemDetail = turtle.getItemDetail()
- until currentItemDetail.name == "minecraft:cobblestone" and currentItemDetail.count >= 8
- -- go back to base
- repeat
- turtle.up()
- position[2]=position[2]+1
- until position[2]==0
- -- drop all into chest
- dropAll()
- turtle.select(16)
- dropAll()
- getFromChest("minecraft:cobblestone")
- turtle.transferTo(1,1)
- turtle.transferTo(2,1)
- turtle.transferTo(3,1)
- turtle.transferTo(5,1)
- turtle.transferTo(7,1)
- turtle.transferTo(9,1)
- turtle.transferTo(10,1)
- turtle.transferTo(11,1)
- turtle.drop()
- turtle.craft(1)
- turtle.select(1)
- turtle.placeUp()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement