Advertisement
nikita2007558

робот для спавна душ

Mar 29th, 2024 (edited)
908
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. local com = require("component")
  2. local robot = require("robot")
  3. local event = require("event")
  4. local gpu = require("component").gpu
  5.  
  6. local active_slot = 1
  7. local size = robot.inventorySize()
  8. local redstone = com.redstone
  9. local w, h = 50, 16
  10.  
  11. -- Функция для рисования интерфейса
  12. function drawGUI()
  13.     gpu.fill(1, 1, w, h, " ")
  14.    
  15.     gpu.set(1, 1, "┌" .. string.rep("─", w - 2) .. "┐")
  16.     gpu.set(1, h, "└" .. string.rep("─", w - 2) .. "┘")
  17.     for i = 2, h - 1 do
  18.       gpu.set(1, i, "│")
  19.       gpu.set(w, i, "│")
  20.     end
  21.    
  22.     gpu.set(3, 2, "Робот " .. robot.name() .. " запущен!")
  23.     gpu.set(3, 4, "Для спауна нужно подать сигнал красного камня")
  24. end
  25.  
  26. -- Рисуем интерфейс
  27. drawGUI()
  28.  
  29. -- Основной цикл
  30. while true do
  31.   pcall(robot.place, 0, true)
  32.   if  robot.count(active_slot) == 0 and robot.select(active_slot) ~= size then
  33.       active_slot = active_slot + 1
  34.   end
  35.   if  robot.select(active_slot) == size and robot.count(active_slot) == 0 then
  36.       active_slot = 1
  37.   end
  38.   os.sleep(0)
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement