Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --EN:
- --This program uses virtual maps from ScanVolume
- --program. It will build exactly what's saved
- --in the map.
- --
- --Download ScanVolume from http://pastebin.com/BQn89Swq
- --CZ:
- --Tenhle program pouziva virtualni mapy vytvorene
- --programem ScanVolume a stavi podle nich.
- --
- --Stahnete si ScanVolume z http://pastebin.com/BQn89Swq
- --
- --Input ------------------------------------------
- --
- local tArgs = { ... }
- if #tArgs ~= 1 and #tArgs ~= 2 then
- print("Usage: BuildVolume <map name>")
- return
- end
- if fs.exists("BuildArea") == false then
- print("This program requires BuildArea program in the same directory")
- return
- end
- if fs.isDir(tArgs[1]) == false then
- print("Current map does not exist")
- return
- end
- --Runned by another program?
- local runByProgram = tArgs[2] == "T"
- --Clear screen
- if runByProgram == false then
- term.clear()
- term.setCursorPos(1, 1)
- print("Info: Fuel place only in the last slot")
- print(" Material place anywhere except the last slot")
- print("")
- end
- --
- --Main variables ---------------------------------
- --
- local nSelected = 1
- local WeirdFile = false
- local Z
- --
- --Methods ----------------------------------------
- --
- local function CheckForAll()
- --material
- local bCheck = true
- while bCheck do
- bCheck = false
- if turtle.getItemCount(nSelected) == 0 then
- nSelected = nSelected + 1
- turtle.select(nSelected)
- bCheck = true
- end
- if nSelected == 16 then
- bCheck = false
- nSelected = 1
- turtle.select(nSelected)
- print("Out of material, fill me Im waiting...")
- while turtle.getItemCount(1) == 0 do
- os.sleep(1)
- end
- print("Thanks!")
- end
- end
- --fuel
- if turtle.getFuelLevel() == 0 then
- turtle.select(16)
- local bFirst = true
- while turtle.refuel(1) == false do
- if bFirst then
- print("Out of fuel, waiting...")
- end
- os.sleep(1)
- bFirst = false
- end
- print("Thanks!")
- turtle.select(nSelected)
- end
- end
- --
- --Code -------------------------------------------
- --
- --Read map
- local files = fs.list(tArgs[1])
- local i = 1
- while i <= #files do
- if files[i] ~= "layer"..tostring(i) then
- WeirdFile = true
- end
- i = i + 1
- end
- --Is weird?
- if WeirdFile then
- print("This map is weird!")
- return
- end
- Z = #files
- --Build
- local z = Z
- while z >= 1 do
- shell.run("BuildArea "..tArgs[1].."/layer"..tostring(z).." T")
- if z ~= 1 then
- CheckForAll()
- shell.run("/rom/programs/turtle/go up")
- end
- z = z - 1
- end
- if runByProgram == false then
- print("All done!")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement