Advertisement
nikita2007558

Робот для ломания руд

Jul 18th, 2023 (edited)
739
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. local robot = require "robot"
  2. local component = require "component"
  3. local gpu = component.gpu
  4.  
  5. local w, h = 50, 16
  6.  
  7. function drawGUI()
  8.   gpu.fill(1, 1, w, h, " ")
  9.  
  10.   gpu.set(1, 1, "┌" .. string.rep("─", w - 2) .. "┐")
  11.   gpu.set(1, h, "└" .. string.rep("─", w - 2) .. "┘")
  12.   for i = 2, h - 1 do
  13.     gpu.set(1, i, "│")
  14.     gpu.set(w, i, "│")
  15.   end
  16.  
  17.   gpu.set(3, 2, "Робот " .. robot.name() .. " запущен!")
  18. end
  19.  
  20. drawGUI()
  21.  
  22. while true do
  23.   local mine, temp = robot.detect()
  24.     if mine then
  25.       robot.swing()
  26.     end
  27.   os.sleep(1)
  28. end
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement