LuaScripts/craftCrystal.lua
2021-01-09 20:23:34 +03:00

36 lines
807 B
Lua

local robot = require("robot")
local component = require("component")
local sides = require("sides")
local event = require("event")
local computer = require("computer")
local shell = require("shell")
local rs = component.redstone
local flag = false
shell.execute("clear")
print("U - обновить ПО робота, E - выйти в OpenOS")
function onKeyPressed()
local _, _, _, key, _ = event.pull(0.05, "key_down")
if key == 0x16 then
computer.shutdown(true)
elseif key == 0x12 then
os.exit()
end
end
while true do
onKeyPressed()
if rs.getInput(sides.right) > 0 then
flag = true
robot.suckUp()
robot.dropDown()
else
if flag then
flag = false
os.sleep(5)
end
robot.suckDown()
robot.drop()
end
end