1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-20 18:27:40 +00:00

Overlapping windows

This commit is contained in:
kepler155c@gmail.com
2016-12-22 23:22:04 -05:00
parent 977998ebdb
commit d61260ec9b
13 changed files with 492 additions and 254 deletions

View File

@@ -117,15 +117,19 @@ process:newThread('discovery_server', function()
end
end)
local info = {
id = os.getComputerID()
}
local function sendInfo()
local info = {
id = os.getComputerID(),
label = os.getComputerLabel(),
uptime = math.floor(os.clock()),
}
info.label = os.getComputerLabel()
info.uptime = math.floor(os.clock())
if turtle then
info.fuel = turtle.getFuelLevel()
info.status = turtle.status
info.point = turtle.point
info.inventory = turtle.getInventory()
info.coordSystem = turtle.getState().coordSystem
end
device.wireless_modem.transmit(999, os.getComputerID(), info)
end
@@ -152,13 +156,11 @@ end)
if os.isTurtle() then
process:newThread('turtle_heartbeat', function()
local lastUpdate = os.clock()
os.sleep(1)
while true do
os.pullEvent('turtle_response')
if os.clock() - lastUpdate >= 1 then
lastUpdate = os.clock()
if turtle.status ~= info.status or
turtle.fuel ~= info.fuel then
sendInfo()
end
end