Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local com = require("component")
- local robot = require("robot")
- local event = require("event")
- local gpu = require("component").gpu
- local active_slot = 1
- local size = robot.inventorySize()
- local redstone = com.redstone
- local w, h = 50, 16
- -- Функция для рисования интерфейса
- function drawGUI()
- gpu.fill(1, 1, w, h, " ")
- gpu.set(1, 1, "┌" .. string.rep("─", w - 2) .. "┐")
- gpu.set(1, h, "└" .. string.rep("─", w - 2) .. "┘")
- for i = 2, h - 1 do
- gpu.set(1, i, "│")
- gpu.set(w, i, "│")
- end
- gpu.set(3, 2, "Робот " .. robot.name() .. " запущен!")
- gpu.set(3, 4, "Для спауна нужно подать сигнал красного камня")
- end
- -- Рисуем интерфейс
- drawGUI()
- -- Основной цикл
- while true do
- pcall(robot.place, 0, true)
- if robot.count(active_slot) == 0 and robot.select(active_slot) ~= size then
- active_slot = active_slot + 1
- end
- if robot.select(active_slot) == size and robot.count(active_slot) == 0 then
- active_slot = 1
- end
- os.sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement