Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- left = true
- slot = 1
- width = 0
- depth = 0
- restart = "testPlatform" -- name of program for reseting
- -- Checks for Empty slot and switches if empty
- local function slotCheck()
- if turtle.getItemCount() == 0 then
- slot = slot + 1
- end
- turtle.select(slot)
- end
- -- checks for material and fuel
- local function matCheck()
- material = 0
- for i = 1, 16 do
- turtle.select(i)
- material = material + turtle.getItemCount()
- end
- fuel = turtle.getFuelLevel()
- materialRequired = width * depth
- if materialRequired > material then
- print("Not enough material to complete task")
- shell.run(restart)
- elseif materialRequired > fuel then
- print("Not enough fuel to complete task")
- shell.run(restart)
- else
- print("Materials and fuel are sufficient, starting platform")
- end
- end
- -- Startup prompt
- print("Platform dimensions, Width to the left and depth straight ahead.")
- print("Enter a width")
- width = read()
- print("Enter a depth")
- depth = read()
- matCheck()
- -- Start of turtle movement
- turtle.select(1)
- for i = 1, width do
- for j = 1, depth do
- slotCheck()
- turtle.placeDown()
- turtle.forward()
- end
- if left == true then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- left = false
- else
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- left = true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement