Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Minecraft Sky Factory 2 platforms Builder.
- -- Requires:
- -- Slot 1,15 Resources
- -- Slot 16, Coal
- -- Name your turtle by using the cmd : label set turtle
- -- this turtle builds form left to right
- -- place turtle on block next to the platform that you wanna build
- local Moveto ="r"
- local NextSlot
- local lastslotValid=1
- local ResourcesAmount=1
- local width
- local length
- turtle.select(1)
- turtle.back()
- local function NextSelect()
- for i = lastslotValid, 15 do
- turtle.select(i)
- itemCount = turtle.getItemCount(i)
- if itemCount ~= 0 then
- NextSlot=i
- lastslotValid=i
- ResourcesAmount=1
- break
- else
- lastslotValid=i
- NextSlot=i
- ResourcesAmount=0
- end
- end
- end
- function MoveBack()
- NextSelect()
- turtle.select(NextSlot)
- turtle.back()
- turtle.place()
- end
- function MoveIt()
- NextSelect()
- turtle.select(NextSlot)
- turtle.turnLeft()
- turtle.back()
- turtle.down()
- end
- function MoveItleft()
- NextSelect()
- turtle.select(NextSlot)
- turtle.turnRight()
- turtle.back()
- turtle.place()
- turtle.turnRight()
- end
- function MoveItRight()
- NextSelect()
- turtle.select(NextSlot)
- turtle.turnLeft()
- turtle.back()
- turtle.place()
- turtle.turnLeft()
- end
- local function GetResources()
- local OneSlotFull
- for i = 1, 15 do
- turtle.select(i)
- itemCount = turtle.getItemCount(i)
- if itemCount ~= 0 then
- OneSlotFull=true
- end
- end
- if OneSlotFull then
- return true
- else
- print("No Resources feed Me ")
- return false
- end
- end
- local function TurtleReFuel()
- for i = 1, 16 do
- turtle.select(i)
- if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then
- turtle.refuel()
- end
- end
- turtle.select(1)
- if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then
- print("your turtle needs fuel to move put some into last slot")
- return false
- else
- return true
- end
- end
- function backtoYou(l,w)
- if width%2==0 then
- turtle.up()
- turtle.forward()
- turtle.turnRight()
- for i=1,width do
- turtle.forward()
- end
- else
- turtle.up()
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,length do
- turtle.forward()
- end
- turtle.turnRight()
- for i=1,width do
- turtle.forward()
- end
- end
- end
- print ("Enter the length:")
- local inputL = read()
- while tonumber(inputL) == nil or tonumber(inputL) < 1 do
- print("You incorrectly enter the length . must be sup then 1.")
- write ("Enter the length :")
- inputL = read()
- end
- length = tonumber(inputL)
- print ("Enter the width:")
- local inputW = read()
- while tonumber(inputW) == nil or tonumber(inputW) < 1 do
- print("You incorrectly enter the width . must be sup then 1.")
- write("Enter the width :")
- inputW = read()
- end
- width = tonumber(inputW)
- if GetResources() and TurtleReFuel() then
- MoveIt()
- for j=1,width do
- for i=1,length-1 do
- MoveBack()
- while ResourcesAmount==0 do
- print("add more resources to continue! y/n")
- local ans = read()
- if ans=="y" then
- lastslotValid=1
- NextSelect()
- elseif ans=="n" then
- print("Goodbye")
- return
- end
- turtle.place()
- i=i-1
- end
- end
- if Moveto =="r" then
- MoveItleft()
- else
- MoveItRight()
- end
- if Moveto =="r" then
- Moveto = "l"
- else
- Moveto = "r"
- end
- end
- backtoYou()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement