Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --EN:
- --This programs creates 3D virtual maps
- --CZ:
- --Tenhle program vytvari 3D mapy
- --
- --Input ------------------------------------------
- --
- local tArgs = { ... }
- if #tArgs ~= 4 and #tArgs ~= 5 then
- print("Usage: ScanVolume <x> <y> <z> <map name>")
- return
- end
- if fs.exists("ScanDestroyArea") == false then
- print("This program requires ScanDestroyArea program in the same directory")
- return
- end
- if fs.isDir(tArgs[4]) then
- print("Current directory already exists")
- return
- end
- --Runned by another program?
- local runByProgram = tArgs[5] == "T"
- --Clear screen
- if runByProgram == false then
- term.clear()
- term.setCursorPos(1, 1)
- print("Info: Fuel place only in the last slot")
- print(" Run only on mining turtle")
- print("")
- end
- --
- --Main variables ---------------------------------
- --
- local X = tonumber(tArgs[1])
- local Y = tonumber(tArgs[2])
- local Z = tonumber(tArgs[3])
- --
- --Methods ----------------------------------------
- --
- local function CheckForAll()
- --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(1)
- end
- end
- --
- --Code -------------------------------------------
- --
- --Make dir
- fs.makeDir(tArgs[4])
- --Scan
- local i = 1
- while i <= Z do
- shell.run("ScanDestroyArea "..tostring(X).." "..tostring(Y).." "..tArgs[4].."/layer"..tostring(i))
- if i ~= Z then
- CheckForAll()
- shell.run("/rom/programs/turtle/go down")
- end
- i = i + 1
- end
- if runByProgram == false then
- print("All done!")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement