Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --computercraft road building program
- --slot1=filling material
- --slot2=line material
- --slot16=fuel
- --2013 invasiveca
- function dig()
- turtle.digUp()
- while turtle.detectUp() do
- turtle.digUp()
- os.sleep(1)
- end
- turtle.up()
- turtle.digUp()
- while turtle.detectUp() do
- turtle.digUp()
- os.sleep(1)
- end
- turtle.down()
- turtle.dig()
- while turtle.detect() do
- turtle.dig()
- os.sleep(1)
- end
- turtle.digDown()
- os.sleep(1)
- end
- function checkFuel()
- if turtle.getFuelLevel() <= 20 then
- turtle.select(16)
- turtle.refuel(1)
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- repeat
- print("Enter road length: ")
- roadLength = tonumber(read())
- until roadLength > 3
- repeat
- print("Enter part of road [line, fill]: ")
- part = read()
- until (part=="line") or (part=="fill")
- print("Place filling material in slots 1-15")
- print("Place fuel in slot 16")
- if part=="line" then
- print("Place line material in slots 8-15")
- end
- print("Begin building?")
- print("0=Cancel Program, Any Key=Yes")
- beginbuild = read()
- if beginbuild == "0" then
- os.reboot()
- end
- term.clear()
- term.setCursorPos(1,1)
- roadLength = roadLength + 1
- cslot = 1 --current slot
- if part=="fill" then
- for i = 1, roadLength do
- dig()
- cslot=1
- turtle.select(cslot)
- turtle.placeDown()
- turtle.forward()
- checkFuel()
- end
- else
- for i = 1, roadLength do
- dig()
- if i % 3 == 0 then
- cslot=1
- else
- cslot=2
- end
- turtle.select(cslot)
- turtle.placeDown()
- turtle.forward()
- checkFuel()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment