network sniffer

This commit is contained in:
kepler155c@gmail.com
2019-02-23 18:36:42 -05:00
parent 3d875890b0
commit 5dc87ef8d1
4 changed files with 5 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ local page = UI.Page {
{ heading = 'Status', key = 'status' }, { heading = 'Status', key = 'status' },
{ heading = 'Fuel', key = 'fuel' }, { heading = 'Fuel', key = 'fuel' },
}, },
sortColumn = 'label', sortColumn = 'distance',
autospace = true, autospace = true,
}, },
} }

View File

@@ -16,7 +16,7 @@ local function hijackTurtle(remoteId)
local hijack = { } local hijack = { }
for _,method in pairs(methods) do for _,method in pairs(methods) do
hijack[method] = function(...) hijack[method] = function(...)
socket:write({ fn = method, args = { ... } }) socket:write({ method, ... })
local resp = socket:read() local resp = socket:read()
if not resp then if not resp then
error('timed out: ' .. method) error('timed out: ' .. method)

View File

@@ -57,7 +57,7 @@ local function hijackTurtle(remoteId)
local hijack = { } local hijack = { }
for _,method in pairs(methods) do for _,method in pairs(methods) do
hijack[method] = function(...) hijack[method] = function(...)
socket:write({ fn = method, args = { ... } }) socket:write({ method, ... })
local resp = socket:read() local resp = socket:read()
if not resp then if not resp then
error('timed out: ' .. method) error('timed out: ' .. method)

View File

@@ -22,6 +22,7 @@ if not turtle.select('minecraft:bucket') then
end end
local s, m = turtle.run(function() local s, m = turtle.run(function()
turtle.set({ 'status', 'refueling' })
turtle.setMovementStrategy('goto') turtle.setMovementStrategy('goto')
local facing = scanner.getBlockMeta(0, 0, 0).state.facing local facing = scanner.getBlockMeta(0, 0, 0).state.facing
@@ -58,6 +59,7 @@ end)
turtle.gotoY(0) turtle.gotoY(0)
turtle.go({ x = 0, y = 0, z = 0 }) turtle.go({ x = 0, y = 0, z = 0 })
turtle.set({ 'status', 'idle' })
turtle.unequip('left') turtle.unequip('left')
print('Fuel: ' .. turtle.getFuelLevel()) print('Fuel: ' .. turtle.getFuelLevel())