Advertisement
Solomeister

Holomap Minecraft OpenOs v0.1

Dec 16th, 2018
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.65 KB | None | 0 0
  1. --Компоненты
  2. local component = require("component")
  3. local computer = require("computer")
  4. local keyboard = require("keyboard")
  5. local term = require ("term")
  6. local gpu = component.gpu
  7. local geo = component.geolyzer
  8. local holo = component.hologram
  9. --Переменные
  10. local scanned
  11. local y
  12. local progress
  13. --Подтверждение
  14.  function confirmation()
  15.     print("Введите 'start' чтобы создать голограмму области, 'exit' чтобы выйти.")
  16.     s = term.read()
  17.     if s:find('start') ~= nil then
  18.         term.clear()
  19.         scanHolo()
  20.     elseif s:find('exit') ~= nil then
  21.         term.clear()
  22.         os.exit()
  23.     end
  24. end
  25.  
  26.  
  27. --Полоса загрузки
  28.  function loading()
  29.   term.write("Прогресс: ")
  30.   term.write("[")
  31.   x, y = term.getCursor()
  32.   term.setCursor(61, y)
  33.   term.write("]")
  34.   term.setCursor(x, y)
  35.  end
  36.  
  37.  
  38. --Создание голограммы
  39.  function scanHolo()
  40.   term.write("Подготовка...\n")
  41.   computer.beep(800, 0.5)
  42.   os.sleep(0.5)
  43.   computer.beep(400, 0.5)
  44.   holo.setTranslation(0, 0, 0)
  45.   holo.setPaletteColor(1, 0x000000)
  46.   holo.setRotationSpeed(1, 0, 23, 0)
  47.   holo.clear()
  48.   term.write("Создаю голограмму...\n")
  49.   loading()
  50.   for k = -24, 24 do
  51.     _, y = term.getCursor()
  52.     progress = math.floor(((k+24)/48)*100)
  53.     term.write("=")
  54.     gpu.set(63, y, progress.."%")
  55.     for j = -24, 24 do
  56.     scanned = geo.scan(k, j)
  57.         for i = 1, #scanned do
  58.         if scanned[i] ~= 0 then
  59.             holo.set(k+24,i-32, j+24, 2)
  60.         end
  61.         end
  62.     end
  63.   end
  64.   term.write("\nЗавершение...")
  65.   computer.beep(600, 1)
  66.   end
  67. confirmation()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement