mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
Update Drone Bios
This commit is contained in:
parent
2b6f456c8c
commit
40b5f9f86c
|
@ -1,25 +1,3 @@
|
||||||
local drone=component.proxy(component.list("drone")())
|
|
||||||
local network=component.proxy(component.list("tunnel")())
|
|
||||||
|
|
||||||
while true do
|
|
||||||
local evt,_,sender,port,dist,cmd=computer.pullSignal()
|
|
||||||
if(evt=="modem_message") then
|
|
||||||
local xok,xresult=pcall(function()
|
|
||||||
local ok,result=pcall(load(cmd))
|
|
||||||
if(ok) then
|
|
||||||
network.send(result)
|
|
||||||
else
|
|
||||||
network.send("Command Execute Failed: " .. result)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
if(not xok) then
|
|
||||||
network.send("Internal Error: " .. xresult)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
drone=component.proxy(component.list("drone")())
|
drone=component.proxy(component.list("drone")())
|
||||||
drone.setStatusText("Drone v3.0")
|
drone.setStatusText("Drone v3.0")
|
||||||
modem=component.proxy(component.list("modem")())
|
modem=component.proxy(component.list("modem")())
|
||||||
|
@ -67,26 +45,3 @@ end
|
||||||
while true do
|
while true do
|
||||||
handle_event(table.pack(computer.pullSignal()))
|
handle_event(table.pack(computer.pullSignal()))
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------
|
|
||||||
--- sleep implementation for drone
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
sleep=function(sec)
|
|
||||||
local deadline=computer.uptime() + sec
|
|
||||||
while true do
|
|
||||||
local raw_event=table.pack(computer.pullSignal(deadline-computer.uptime()))
|
|
||||||
if(raw_event[1]==nil) then break
|
|
||||||
else handle_event(raw_event)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
------------------------------------
|
|
||||||
-- Wireless ADS Sender (Running on Computer)
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
while true do
|
|
||||||
component.modem.broadcast(101,"ads_tower","MainCity")
|
|
||||||
os.sleep(1)
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user