Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tileset = {
- air = {" ",colors.black},
- water = {"~",colors.blue},
- lava = {"~",colors.red},
- flowing_lava = {"~",colors.red},
- computer = {"C",colors.lightGray},
- turtle_advanced = {"\2",colors.yellow},
- turtle_expanded = {"\2",colors.lightGray},
- turtle = {"\2",colors.lightGray},
- peripheral = {"+",colors.white},
- advanced_modem = {"+",colors.yellow},
- cable = {"+",colors.lightGray},
- audio_cable = {"+",colors.gray},
- tallgrass = {'"',colors.green},
- double_plant = {'"',colors.green},
- vine = {"|",colors.green},
- ladder = {"|",colors.brown},
- rope = {"|",colors.white},
- leaves = {"\153",colors.green},
- waterlily = {"\248",colors.green},
- reeds = {"\165",colors.green},
- cactus = {"\165",colors.green},
- yellow_flower = {"*",colors.yellow},
- red_flower = {"*",colors.red},
- sand = {"\127",colors.yellow},
- gravel = {"\127",colors.lightGray},
- grass = {"\143",colors.green},
- dirt = {"\143",colors.brown},
- stone = {"\143",colors.lightGray},
- cobblestone = {"\143",colors.gray},
- log = {"\143",colors.brown},
- planks = {"\143",colors.brown},
- obsidian = {"\143",colors.purple},
- stone_button = {"r",colors.lightGray},
- wooden_button = {"r",colors.brown},
- light_button = {"r",colors.white},
- lever = {"r",colors.brown},
- redstone_wire = {"r",colors.red},
- redstone_torch = {"r",colors.red},
- repeater = {"r",colors.red},
- comparator = {"r",colors.red},
- observer = {"r",colors.gray},
- piston = {"r",colors.brown},
- sticky_piston = {"r",colors.green},
- redstone_block = {"r",colors.red},
- noteblock = {"\15",colors.brown},
- speaker = {"\15",colors.lightGray},
- tape_reader = {"\15",colors.lightGray},
- iron_bars = {"#",colors.lightGray},
- ironpane = {"#",colors.lightGray},
- glass = {"#",colors.white},
- glass_pane = {"#",colors.white},
- glasspane = {"#",colors.white},
- glasspanedyedblack = {"#",colors.white},
- stained_glass = {"#",colors.white},
- stained_glass_pane = {"#",colors.white},
- space_glass_clear = {"#",colors.white},
- cobblestone_wall = {"#",colors.gray},
- editable_wall = {"#",colors.brown},
- editable_wall_reinforced = {"#",colors.brown},
- editable_fence = {"#",colors.brown},
- editable_fence_reinforced = {"#",colors.brown},
- rail = {"=",colors.brown},
- track_outfitted = {"=",colors.brown},
- track_flex_electric = {"=",colors.brown},
- track_flex_hs_electric = {"=",colors.brown},
- wall_sign = {"?",colors.brown},
- standing_sign = {"?",colors.brown},
- glowstone = {"i",colors.yellow},
- torch = {"i",colors.yellow},
- interdiction_torch = {"i",colors.green},
- lamp = {"i",colors.yellow},
- blaze_lantern = {"i",colors.yellow},
- redstone_lamp = {"i",colors.red},
- lit_redstone_lamp = {"i",colors.red},
- fire = {"i",colors.orange},
- wool = {"w",colors.white},
- furnace = {"f",colors.lightGray},
- brewing_stand = {"b",colors.yellow},
- cauldron = {"c",colors.blue},
- chest = {"c",colors.brown},
- custom_chest = {"c",colors.brown},
- alchemical_chest = {"c",colors.lightGray},
- ender_chest = {"c",colors.green},
- ender_storage = {"c",colors.white},
- condenser_mk1 = {"c",colors.red},
- condenser_mk2 = {"c",colors.red},
- crafting_table = {"\169",colors.brown},
- autoworkbench_item = {"\169",colors.brown},
- pipe = {"\177",colors.lightGray},
- portal = {"@",colors.purple},
- coal_ore = {"\4",colors.gray},
- iron_ore = {"\4",colors.lightGray},
- gold_ore = {"\4",colors.orange},
- redstone_ore = {"\4",colors.red},
- lapis_ore = {"\4",colors.blue},
- diamond_ore = {"\4",colors.lightBlue},
- emerald_ore = {"\4",colors.green},
- copper_ore = {"\4",colors.orange},
- tin_ore = {"\4",colors.white},
- silver_ore = {"\4",colors.white},
- lead_ore = {"\4",colors.white},
- nickel_ore = {"\4",colors.white},
- platinum_ore = {"\4",colors.white},
- uranium_ore = {"\4",colors.white},
- aluminum_ore = {"\4",colors.white},
- zinc_ore = {"\4",colors.white},
- osmium_ore = {"\4",colors.white},
- sulfur_ore = {"\4",colors.white},
- ruby_ore = {"\4",colors.white},
- sapphire_ore = {"\4",colors.white},
- peridot_ore = {"\4",colors.white},
- certus_quartz_ore = {"\4",colors.white},
- charged_certus_quartz_ore = {"\4",colors.white},
- amber_ore = {"\4",colors.white},
- topaz_ore = {"\4",colors.white},
- tanzanite_ore = {"\4",colors.white},
- malachite_ore = {"\4",colors.white},
- coal_block = {"\143",colors.gray},
- iron_block = {"\143",colors.lightGray},
- gold_block = {"\143",colors.orange},
- redstone_block = {"\143",colors.red},
- lapis_block = {"\143",colors.blue},
- diamond_block = {"\143",colors.lightBlue},
- emerald_block = {"\143",colors.green},
- }
- mapPath = "./data/map"
- yieldTime = os.clock()
- yield = function()
- if os.clock()-yieldTime>2 then
- os.queueEvent("yield")
- os.pullEvent("yield")
- yieldTime = os.clock()
- end
- end
- args={...}
- sX,sY = term.getSize()
- radar = function()
- level = {}
- scanner = nil
- if peripheral.find("neuralInterface") and peripheral.find("neuralInterface").hasModule("plethora:scanner") then
- scanner = peripheral.wrap("back")
- neural = true
- else scanner = peripheral.find("plethora:scanner") end
- if scanner == nil then
- term.setCursorPos(1,sY)
- term.clearLine()
- print("Requires Plethora Block Scanner!")
- else
- scan = scanner.scan()
- selected = tonumber(args[1])
- if selected == nil then
- selected = 0
- elseif selected > 8 then
- selected = 8
- elseif selected < -8 then
- selected = -8
- end
- size = tonumber(args[2])
- if size == nil then size = 13
- elseif size > 17 then
- size = 17
- elseif size < 1 then
- size = 1
- end
- indent = math.floor((17-size)/2)
- offset = math.floor((11-size)/2)
- if size < 11 then
- for n = 1,offset do
- write("\n")
- end
- offset = 0
- end
- margin = ""
- for i = 1,indent do
- margin = margin.." "
- end
- if neural then
- for n = 1,#scan do
- scan[n].y = math.floor(scan[n].y)
- scan[n].x = math.floor(scan[n].x)
- scan[n].z = math.floor(scan[n].z)
- end
- end
- for i = 1,#scan do
- if scan[i].y == selected then
- name = scan[i].name
- name = name:sub(string.find(name,":")+1, #name)
- scan[i].nameP = name
- table.insert(level,scan[i])
- end
- end
- for col = -8+indent,8-indent+offset do
- write(margin)
- for row = -8+indent,8-indent do
- for block = 1,#level do
- if level[block].z == col then
- if level[block].x == row then
- name = level[block].nameP
- tX, tY = term.getCursorPos()
- tY = tY + offset
- level[block].tX = tX
- level[block].tY = tY
- notFound = true
- for k,v in pairs(tileset) do
- if k == name then
- if (term.isColour()) and (v[2]~=nil) then
- term.setTextColor(v[2])
- end
- write(v[1].." ")
- term.setTextColor(colors.white)
- notFound = false
- end
- end
- if notFound then write("\143 ") end
- end
- end
- end
- end
- write("\n")
- end
- if selected < 0 then lPref = "Y:"
- else lPref = "Y: " end
- if size < 10 then sPref = "S: "
- else sPref = "S:" end
- levelString = lPref..tostring(selected)
- scaleString = sPref..tostring(size)
- term.setCursorPos(sX-#levelString+1,1)
- write(levelString)
- term.setCursorPos(sX-#scaleString+1,2)
- write(scaleString)
- end
- end
- saveMap = function()
- myX = nil
- myX, myY, myZ = gps.locate()
- if myX == nil then
- term.setCursorPos(1,sY)
- term.clearLine()
- print("GPS not found!")
- else
- myX = math.floor(myX)
- myY = math.floor(myY)
- myZ = math.floor(myZ)
- if fs.exists(mapPath) then
- mapFile = fs.open(mapPath, "r")
- map = mapFile.readAll()
- map = textutils.unserialize(map)
- mapFile.close()
- else
- mapFile = fs.open(mapPath, "w")
- mapFile.close()
- map = {} end
- s = "Saving"
- term.setCursorPos(sX-#s+1,sY)
- write(s)
- for i = 1,#scan do
- blockExists = false
- for n = 1,#map do
- yield()
- if ((scan[i].y+myY) == map[n].y) and ((scan[i].x+myX) == map[n].x) and ((scan[i].z+myZ) == map[n].z) then
- blockExists = true
- if scan[i].name ~= map[n].name then
- map[n].name = scan[i].name end
- if scan[i].name == ("computercraft:turtle_advanced" or "computercraft:turtle" or "computercraft:turtle_expanded") then
- map[n].name = "minecraft:air" end
- break
- end
- end
- if not blockExists then
- table.insert(map,{y=(scan[i].y+myY), x=(scan[i].x+myX), z=(scan[i].z+myZ), name=scan[i].name})
- end
- end
- mapFile = fs.open(mapPath, "w")
- mapString = "{"
- for t = 1,#map do
- item = tostring(textutils.serialise(map[t]))
- mapString = mapString..item..","
- end
- mapString = mapString.."}"
- mapFile.write(mapString)
- mapFile.close()
- end
- end
- change = true
- while true do
- if change then
- shell.run("clear")
- radar()
- change = false
- else yield() end
- evt, e1, e2, e3 = os.pullEvent()
- if evt == "key" then
- if e1 == keys.up then
- args[1] = selected + 1
- change = true
- elseif e1 == keys.down then
- args[1] = selected - 1
- change = true
- elseif e1 == keys.right then
- args[2] = size + 2
- change = true
- elseif e1 == keys.left then
- args[2] = size - 2
- change = true
- elseif e1 == keys.enter then
- saveMap()
- change = true
- elseif e1 == keys.space then
- change = true
- end
- elseif evt == "mouse_scroll" then
- if e1 == 1 then
- args[1] = selected - 1
- change = true
- elseif e1 == -1 then
- args[1] = selected + 1
- change = true
- end
- elseif evt == "mouse_click" then
- for i = 1,#level do
- if (tonumber(level[i].tX) == tonumber(e2)) and (tonumber(level[i].tY) == tonumber(e3)) then
- selectedBlock = tostring(textutils.serialise(level[i].nameP))
- selectedBlock = string.sub(selectedBlock,2,#selectedBlock-1):gsub("_"," ")
- term.setCursorPos(1,sY)
- term.clearLine()
- if #selectedBlock < sX then
- write(selectedBlock)
- else write(string.sub(selectedBlock,1,sX-3).."...") end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment