mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
Update transport client.
AutoInstaller is updated.
This commit is contained in:
parent
bd44d42ab4
commit
ce72f016f5
|
@ -1,17 +1,24 @@
|
||||||
local component=require("component")
|
local component=require("component")
|
||||||
local event=require("event")
|
require("libevent")
|
||||||
require("util")
|
require("util")
|
||||||
|
|
||||||
--- Auto Configure
|
--- Auto Configure
|
||||||
local digital_controller = proxy("digital_controller_box")
|
local digital_controller = proxy("digital_controller_box")
|
||||||
local digital_receiver = proxy("digital_receiver_box")
|
local digital_receiver = proxy("digital_receiver_box")
|
||||||
local transposer = proxy("transposer")
|
local out_ticket = proxy("routing_track")
|
||||||
local routing_track = proxy("routing_track")
|
|
||||||
|
|
||||||
--- Manually Configure
|
--- Manually Configure
|
||||||
local route_in_ab = proxy("routing_switch","6")
|
local load_detector = proxy("digital_detector","0")
|
||||||
local route_in_ba = proxy("routing_switch","a")
|
local unload_detector = proxy("digital_detector","4")
|
||||||
local route_out = proxy("routing_switch","1")
|
|
||||||
|
local load_transposer = proxy("transposer","7")
|
||||||
|
local unload_transposer = proxy("transposer","6")
|
||||||
|
|
||||||
|
local route_ab_load = proxy("routing_switch","0c")
|
||||||
|
local route_ba_load = proxy("routing_switch","088")
|
||||||
|
local route_ab_unload = proxy("routing_switch","08c")
|
||||||
|
local route_ba_unload = proxy("routing_switch","c")
|
||||||
|
|
||||||
|
|
||||||
-- Value: 1 Green 2 Blinking Yello 3 Yello 4 Blinking Red 5 Red
|
-- Value: 1 Green 2 Blinking Yello 3 Yello 4 Blinking Red 5 Red
|
||||||
local green=1
|
local green=1
|
||||||
|
@ -25,6 +32,8 @@ local function setSignal(name,value)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkDevice()
|
local function checkDevice()
|
||||||
|
print("Checking Devices...")
|
||||||
|
|
||||||
local function doCheckDevice(device)
|
local function doCheckDevice(device)
|
||||||
if(device==nil) then
|
if(device==nil) then
|
||||||
error("Some device is nil. Please double check your configure.")
|
error("Some device is nil. Please double check your configure.")
|
||||||
|
@ -33,11 +42,14 @@ local function checkDevice()
|
||||||
|
|
||||||
doCheckDevice(digital_controller)
|
doCheckDevice(digital_controller)
|
||||||
doCheckDevice(digital_receiver)
|
doCheckDevice(digital_receiver)
|
||||||
doCheckDevice(transposer)
|
doCheckDevice(out_ticket)
|
||||||
doCheckDevice(routing_track)
|
|
||||||
doCheckDevice(route_in_ab)
|
doCheckDevice(load_detector)
|
||||||
doCheckDevice(route_in_ba)
|
doCheckDevice(unload_detector)
|
||||||
doCheckDevice(route_out)
|
doCheckDevice(route_ab_load)
|
||||||
|
doCheckDevice(route_ba_load)
|
||||||
|
doCheckDevice(route_ab_unload)
|
||||||
|
doCheckDevice(route_ba_unload)
|
||||||
|
|
||||||
local t=digital_controller.getSignalNames()
|
local t=digital_controller.getSignalNames()
|
||||||
|
|
||||||
|
@ -51,23 +63,49 @@ local function checkDevice()
|
||||||
error("CheckSigName: Failed to check signal: " .. name)
|
error("CheckSigName: Failed to check signal: " .. name)
|
||||||
end
|
end
|
||||||
|
|
||||||
checkSigName("Cart_Ctrl")
|
checkSigName("AInCtrl")
|
||||||
checkSigName("Lamp")
|
checkSigName("BInCtrl")
|
||||||
checkSigName("Box_Ctrl")
|
checkSigName("LoadCartCtrl")
|
||||||
|
checkSigName("LoadBoxCtrl")
|
||||||
|
checkSigName("UnloadCartCtrl")
|
||||||
|
checkSigName("UnloadBoxCtrl")
|
||||||
|
checkSigName("OutCtrl")
|
||||||
|
|
||||||
t=digital_receiver.getSignalNames()
|
t=digital_receiver.getSignalNames()
|
||||||
checkSigName("Cart_Ready")
|
checkSigName("LoadCartSig")
|
||||||
|
checkSigName("UnloadCartSig")
|
||||||
|
|
||||||
|
local function checkRoutingTable(device)
|
||||||
|
if(device.getRoutingTableTitle()==false) then
|
||||||
|
error("CheckRoutingTable: Failed to check routing table. Please insert a routing table in it.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
checkRoutingTable(route_ab_load)
|
||||||
|
checkRoutingTable(route_ba_load)
|
||||||
|
checkRoutingTable(route_ab_unload)
|
||||||
|
checkRoutingTable(route_ba_unload)
|
||||||
|
|
||||||
|
local function checkRoutingTicket(device)
|
||||||
|
if(device.getDestination()==false) then
|
||||||
|
error("CheckRoutingTicket: Failed to check routing track. Please insert a golden ticket in it.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
checkRoutingTicket(out_ticket)
|
||||||
|
|
||||||
print("Check device pass.")
|
print("Check device pass.")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function resetDevice()
|
local function resetDevice()
|
||||||
digital_controller.setEveryAspect(red)
|
print("Reseting Devices...")
|
||||||
setSignal("Lamp",green)
|
|
||||||
|
|
||||||
route_in_ab.setRoutingTable({})
|
digital_controller.setEveryAspect(red)
|
||||||
route_in_ba.setRoutingTable({})
|
|
||||||
route_out.setRoutingTable({})
|
route_ab_load.setRoutingTable({})
|
||||||
|
route_ba_load.setRoutingTable({})
|
||||||
|
route_ab_unload.setRoutingTable({})
|
||||||
|
route_ba_unload.setRoutingTable({})
|
||||||
|
|
||||||
print("Device reset done.")
|
print("Device reset done.")
|
||||||
end
|
end
|
||||||
|
@ -75,11 +113,9 @@ end
|
||||||
local function main()
|
local function main()
|
||||||
checkDevice()
|
checkDevice()
|
||||||
resetDevice()
|
resetDevice()
|
||||||
|
|
||||||
while true do
|
|
||||||
print("Please put your things in the box. Then press ENTER.")
|
|
||||||
local e=event.pull(e)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print("Transport System Client Started.")
|
||||||
|
print("Author: Kiritow")
|
||||||
main()
|
main()
|
||||||
|
print("Transport System Client Stopped.")
|
|
@ -2,12 +2,10 @@
|
||||||
local component=require("component")
|
local component=require("component")
|
||||||
|
|
||||||
function DownloadFromGitHub(RepoName,Branch,FileAddress)
|
function DownloadFromGitHub(RepoName,Branch,FileAddress)
|
||||||
local hwtable=component.list()
|
local hwtable=component.list("internet")
|
||||||
local found=false
|
local found=false
|
||||||
for k,v in pairs(hwtable) do
|
for k,v in pairs(hwtable) do
|
||||||
if(v=="internet") then
|
found=true
|
||||||
found=true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if(not found) then
|
if(not found) then
|
||||||
error("The downloader requires an Internet card.")
|
error("The downloader requires an Internet card.")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user