Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ReturnFileData(filepath)
- local file = fs.open(filepath, "r")
- local filedata = {}
- local line = file.readLine()
- repeat
- table.insert(filedata, line)
- line = file.readLine()
- until line == nil
- file.close()
- return filedata
- end
- function dd()
- if turtle.detectDown() then
- turtle.digDown()
- end
- end
- function pd()
- turtle.placeDown()
- end
- function mf(distance)
- if distance == nil then distance = 1 end
- for i = 1, distance do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- else
- turtle.forward()
- end
- end
- end
- function tl()
- turtle.turnLeft()
- end
- function tr()
- turtle.turnRight()
- end
- function Path(distance)
- turtle.select(3)
- for i = 1, distance do
- mf()
- dd()
- pd()
- end
- end
- function MakePath()
- Path(9) --Initial move forward(1)
- tr()
- Path(4) --Move right forward (2)
- tr()
- Path(5)--Move down forward (3)
- tl()
- Path(4)
- tl()
- Path(4)
- tr()
- Path(4)
- tr()
- Path(8)
- tr()
- Path(11)
- mf()
- tr()
- end
- function SetUp()
- turtle.refuel()
- dd()
- turtle.select(2)
- pd()
- MakePath()
- end
- function CheckSetUp()
- if not fs.exists("Config.lua") then
- local file = fs.open("Config.lua", "w")
- file.close()
- end
- local FileData = ReturnFileData("Config.lua")
- if #FileData == 0 then
- print("Never Set up Before!")
- print("Setting up...")
- local file = fs.open("Config.lua", "a")
- file.writeLine("Setup = true")
- file.close()
- SetUp()
- else
- print(FileData[1])
- print(#FileData)
- print("Set up before")
- end
- end
- CheckSetUp()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement