Update craftCrystal.lua
This commit is contained in:
parent
51596de023
commit
8ffe6dac9c
1 changed files with 17 additions and 6 deletions
|
@ -1,19 +1,30 @@
|
||||||
local robot = require("robot")
|
local robot = require("robot")
|
||||||
local component = require("component")
|
local component = require("component")
|
||||||
local sides = require("sides")
|
local sides = require("sides")
|
||||||
|
local event = require("event")
|
||||||
|
local computer = require("computer")
|
||||||
local rs = component.redstone
|
local rs = component.redstone
|
||||||
local flag = false
|
local flag = false
|
||||||
|
|
||||||
|
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
|
while true do
|
||||||
|
onKeyPressed()
|
||||||
if rs.getInput(sides.top) > 0 then
|
if rs.getInput(sides.top) > 0 then
|
||||||
if not flag then
|
flag = true
|
||||||
robot.turnAround()
|
robot.suckUp()
|
||||||
flag = true
|
|
||||||
end
|
|
||||||
robot.suck()
|
|
||||||
robot.dropDown()
|
robot.dropDown()
|
||||||
else
|
else
|
||||||
if flag then
|
if flag then
|
||||||
robot.turnAround()
|
|
||||||
flag = false
|
flag = false
|
||||||
os.sleep(5)
|
os.sleep(5)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue