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