Advertisement
lartman

OpenMaps2

Nov 14th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local component = require("component")
  2. local geolyzer = component.geolyzer
  3. local gpu = component.gpu -- получаем прокси видеокарты
  4. local sides = require("sides")
  5. local w, h = gpu.getResolution()
  6.  
  7. if not component.isAvailable("geolyzer") then
  8.     print("This program requires a geolyzer")
  9. end
  10.  
  11. function clear()
  12.  gpu.setBackground(0x000000)
  13.  gpu.fill(1, 1, w, h, " ") -- очищаем экран
  14. end
  15.  
  16. function _return()
  17.  gpu.setBackground(0x000000)
  18.  gpu.setForeground(0xFFFFFF)
  19. end
  20.  
  21. local offsetx = 0 -- 4
  22. local offsetz = 0 -- -3
  23. local offsety = 0 -- -5
  24.  
  25. local sizex = 8 --3
  26. local sizez = 8 --4
  27. local sizey = 1 --5
  28.  
  29. local map = {}
  30. local color = 0--x00FF00
  31. local scanData = geolyzer.scan(offsetx, offsetz, offsety, sizex, sizez, sizey)
  32. clear()
  33. local i = 1
  34. for y = 0, sizey - 1 do
  35.     for z = 0, sizez - 1 do
  36.         for x = 0, sizex - 1 do
  37.             -- alternatively when thinking in terms of 3-dimensional table: map[offsety + y][offsetz + z][offsetx + x] = scanData[i]
  38.             map[i] = {posx = offsetx + x, posy = offsety + y, posz = offsetz + z, hardness = scanData[i]}
  39.             i = i + 1
  40.         end
  41.     end
  42. end
  43.  
  44. for i = 1, sizex*sizez*sizey do
  45.     --print(map[i].posx, map[i].posy, map[i].posz, map[i].hardness)
  46.     if tbl[x][y]>99 then
  47.     color = 0x0000FF
  48.    else
  49.     color = 0x00FF00
  50.    end
  51.    gpu.setBackground(color)
  52.    gpu.set(map[i].posx, map[i].posz," ")
  53. end
  54. _return()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement