Advertisement
lartman

OpenMaps

Jun 4th, 2020 (edited)
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. local geo = require("component").geolyzer
  2. local component = require("component")
  3. local gpu = component.gpu -- получаем прокси видеокарты
  4. local w, h = gpu.getResolution()
  5. --local colors = require("colors")
  6. local sh = require("shell")
  7. local keyboard = require("keyboard")
  8. local event = require("event")
  9. local _, char, _, _ = event.pull("key_down")
  10. local args,options = sh.parse(...)
  11. if not component.isAvailable("geolyzer") then
  12.     --print("This program requires a geolyzer")
  13.     io.stderr:write("This program requires an internet card to run.")
  14. end
  15.  
  16. function clear()
  17.  gpu.setBackground(0x000000)
  18.  gpu.fill(1, 1, w, h, " ") -- очищаем экран
  19. end
  20.  
  21. function _return()
  22.  gpu.setBackground(0x000000)
  23.  gpu.setForeground(0xFFFFFF)
  24. end
  25.  
  26. --print(tostring(w).."x"..tostring(h))
  27.  
  28. local tbl = {}
  29. local color = 0--x00FF00
  30. local count = 1
  31.  
  32. clear()
  33. print("OpenMaps v. 1.1 (GUI mode)")
  34.  
  35. --[[if char==keyboard.keys.c then
  36.  exit()
  37. end]]--
  38.  
  39. --[[if args then
  40.  min = args[1]
  41.  n = args[2]
  42. else
  43.  min = -16
  44.  n = 16
  45. end]]--
  46.  
  47. for x = -16, 16 do
  48.   for y = -16, 16 do
  49.     if not tbl[x] then
  50.       tbl[x] = {}
  51.     end
  52.     tbl[x][y]=geo.scan(x,y)[24]
  53.     --print(count)
  54.     --count=count+1
  55.    --print(x.." "..y.." "..tostring(geo.scan(x,y)[32]))
  56.    if tbl[x][y]>=99 then
  57.     color = 0x0000FF --blue
  58.    end
  59.    if tbl[x][y]>=1.44 and tbl[x][y]< 99 then
  60.     color = 0x808080 --gray
  61.    end
  62.    if tbl[x][y]>=0.55 and tbl[x][y]<1.44 then
  63.     color = 0x00FF00 --lime
  64.    end
  65.    if tbl[x][y]>=0.44 and tbl[x][y]< 0.55 then
  66.     color = 0xCD853F --peru
  67.    end
  68.    gpu.setBackground(color)
  69.    gpu.set(x+33,y+35," ")
  70.  end
  71. end
  72. _return()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement