milo wip
This commit is contained in:
@@ -91,6 +91,7 @@ local function harvest(blocks)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
dropped = true
|
dropped = true
|
||||||
|
turtle.condense()
|
||||||
turtle.select(1)
|
turtle.select(1)
|
||||||
end
|
end
|
||||||
elseif b.action == 'smash' then
|
elseif b.action == 'smash' then
|
||||||
|
|||||||
@@ -109,9 +109,10 @@ Event.on('milo_cycle', function()
|
|||||||
for _, task in ipairs(context.tasks) do
|
for _, task in ipairs(context.tasks) do
|
||||||
local s, m = pcall(function() task:cycle(context) end)
|
local s, m = pcall(function() task:cycle(context) end)
|
||||||
if not s and m then
|
if not s and m then
|
||||||
_debug(task.name .. ' crashed')
|
_G._debug(task.name .. ' crashed')
|
||||||
Util.print(task.name .. ' crashed')
|
_G._debug(m)
|
||||||
error(m)
|
-- _G.printError(task.name .. ' crashed')
|
||||||
|
-- _G.printError(m)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context.turtleBusy = false
|
context.turtleBusy = false
|
||||||
|
|||||||
@@ -146,8 +146,14 @@ function page:sendRequest(data)
|
|||||||
self:setStatus('connecting ...')
|
self:setStatus('connecting ...')
|
||||||
socket, msg = Socket.connect(options.server.value, 4242)
|
socket, msg = Socket.connect(options.server.value, 4242)
|
||||||
if socket then
|
if socket then
|
||||||
self:setStatus('connected ...')
|
|
||||||
socket:write(options.user.value)
|
socket:write(options.user.value)
|
||||||
|
local r = socket:read(2)
|
||||||
|
if r and not r.msg then
|
||||||
|
self:setStatus('connected ...')
|
||||||
|
else
|
||||||
|
socket = nil
|
||||||
|
self:setStatus(r.msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if socket then
|
if socket then
|
||||||
|
|||||||
@@ -36,9 +36,10 @@ local machinesPage = UI.Page {
|
|||||||
y = 2, ey = -2,
|
y = 2, ey = -2,
|
||||||
values = context.config.remoteDefaults,
|
values = context.config.remoteDefaults,
|
||||||
columns = {
|
columns = {
|
||||||
{ key = 'priority', width = 3 },
|
{ key = 'suffix', width = 4, justify = 'right' },
|
||||||
{ heading = 'Name', key = 'displayName' },
|
{ heading = 'Name', key = 'displayName' },
|
||||||
{ heading = 'Type', key = 'mtype', width = 5 },
|
{ heading = 'Type', key = 'mtype', width = 4 },
|
||||||
|
{ heading = 'Pri', key = 'priority', width = 3 },
|
||||||
},
|
},
|
||||||
sortColumn = 'displayName',
|
sortColumn = 'displayName',
|
||||||
help = 'Select Machine',
|
help = 'Select Machine',
|
||||||
@@ -57,6 +58,11 @@ local machinesPage = UI.Page {
|
|||||||
|
|
||||||
function machinesPage.grid:getDisplayValues(row)
|
function machinesPage.grid:getDisplayValues(row)
|
||||||
row = Util.shallowCopy(row)
|
row = Util.shallowCopy(row)
|
||||||
|
local t = { row.name:match(':(.+)_(%d+)') }
|
||||||
|
if t and #t == 2 then
|
||||||
|
row.name, row.suffix = table.unpack(t)
|
||||||
|
row.name = row.name .. '_' .. row.suffix
|
||||||
|
end
|
||||||
row.displayName = row.displayName or row.name
|
row.displayName = row.displayName or row.name
|
||||||
return row
|
return row
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,9 +29,16 @@ local function client(socket)
|
|||||||
|
|
||||||
local manipulator = getManipulatorForUser(user)
|
local manipulator = getManipulatorForUser(user)
|
||||||
if not manipulator then
|
if not manipulator then
|
||||||
|
socket:write({
|
||||||
|
msg = 'Manipulator not found'
|
||||||
|
})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
socket:write({
|
||||||
|
data = 'ok',
|
||||||
|
})
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
local data = socket:read()
|
local data = socket:read()
|
||||||
if not data then
|
if not data then
|
||||||
|
|||||||
Reference in New Issue
Block a user