LuaScripts/craftCrystal.lua

37 lines
807 B
Lua
Raw Normal View History

2021-01-04 23:45:03 +00:00
local robot = require("robot")
2021-01-05 13:09:20 +00:00
local component = require("component")
local sides = require("sides")
2021-01-09 17:19:34 +00:00
local event = require("event")
local computer = require("computer")
2021-01-09 17:21:43 +00:00
local shell = require("shell")
2021-01-05 13:09:20 +00:00
local rs = component.redstone
2021-01-05 14:00:31 +00:00
local flag = false
2021-01-09 17:19:34 +00:00
2021-01-09 17:21:43 +00:00
shell.execute("clear")
2021-01-09 17:19:34 +00:00
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
2021-01-05 13:09:20 +00:00
while true do
2021-01-09 17:19:34 +00:00
onKeyPressed()
2021-01-09 17:23:34 +00:00
if rs.getInput(sides.right) > 0 then
2021-01-09 17:19:34 +00:00
flag = true
robot.suckUp()
2021-01-05 13:09:20 +00:00
robot.dropDown()
else
2021-01-05 13:14:05 +00:00
if flag then
flag = false
2021-01-05 14:00:10 +00:00
os.sleep(5)
2021-01-05 13:14:05 +00:00
end
2021-01-05 13:09:20 +00:00
robot.suckDown()
2021-01-05 13:54:33 +00:00
robot.drop()
2021-01-05 13:09:20 +00:00
end
end