Update transport system

Fix bugs in libevent
Update transport client
Update transport center
This commit is contained in:
Kirigaya Kazuto 2018-01-05 08:39:49 +08:00
parent 1da89c1be6
commit 79b82f3f8c
3 changed files with 13 additions and 4 deletions

View File

@ -157,7 +157,7 @@ function WaitEvent(...)
if(tb.n==0) then -- WaitEvent(),event.pull()
return doEventTranslate(table.pack(event.pull()))
elseif(type(tb[1])=="string") then
if(type(tb[2])==nil) then -- WaitEvent("key_up"),event.pull("key_up")
if(tb[2]==nil) then -- WaitEvent("key_up"),event.pull("key_up")
return doEventTranslate(table.pack(event.pull(tb[1])))
else -- WaitEvent("key_up",1),event.pull(1,"key_up")
checknumber(tb[2])

View File

@ -1,9 +1,8 @@
local component=require("component")
local event=require("event")
require("libevent")
require("util")
local function main()
end

View File

@ -7,6 +7,7 @@ require("util")
local digital_controller = proxy("digital_controller_box")
local digital_receiver = proxy("digital_receiver_box")
local out_ticket = proxy("routing_track")
local network_card = proxy("modem")
--- Manually Configure
local load_detector = proxy("digital_detector","0")
@ -23,6 +24,8 @@ local route_ba_unload = proxy("routing_switch","c")
--- Internal Variables
local load_box_side
local unload_box_side
local loading=0 -- 0 Free 1 Ready 2 Processing
local unloading=0
-- Value: 1 Green 2 Blinking Yello 3 Yello 4 Blinking Red 5 Red
@ -48,6 +51,7 @@ local function checkDevice()
doCheckDevice(digital_controller)
doCheckDevice(digital_receiver)
doCheckDevice(out_ticket)
doCheckDevice(network_card)
doCheckDevice(load_detector)
doCheckDevice(unload_detector)
@ -75,6 +79,7 @@ local function checkDevice()
checkSigName("UnloadCartCtrl")
checkSigName("UnloadBoxCtrl")
checkSigName("OutCtrl")
checkSigName("OutSwitchCtrl")
t=digital_receiver.getSignalNames()
checkSigName("LoadCartSig")
@ -162,7 +167,12 @@ end
local function startLoad()
if(loading>0) then
return false,"Loading status not free"
end
lockLoadChest()
local sz=load_transposer.getInventorySize(load_box_side)
local cnt=1
for i=1,sz,1 do
@ -172,7 +182,7 @@ local function startLoad()
end
end
print("startLoad " .. cnt-1 .. " item transferred.")
print("startLoad: " .. cnt-1 .. " item transferred.")
unlockLoadChest()
end