milo logging
This commit is contained in:
@@ -432,7 +432,7 @@ function Storage:export(target, slot, count, item)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
_G._debug('MISS: %s(%d): %s%s %s',
|
_G._debug('STORAGE warning: %s(%d): %s%s %s failed to export',
|
||||||
item.displayName or item.name, count, self:_sn(target.name),
|
item.displayName or item.name, count, self:_sn(target.name),
|
||||||
slot and string.format('[%d]', slot) or '[*]', key)
|
slot and string.format('[%d]', slot) or '[*]', key)
|
||||||
|
|
||||||
@@ -514,8 +514,7 @@ function Storage:import(source, slot, count, item)
|
|||||||
if node.lock and node.lock[key] then
|
if node.lock and node.lock[key] then
|
||||||
insert(node.adapter, item)
|
insert(node.adapter, item)
|
||||||
if count > 0 and node.void then
|
if count > 0 and node.void then
|
||||||
total = total + self:trash(source, slot, count, item)
|
return total + self:trash(source, slot, count, item)
|
||||||
return total
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if count <= 0 then
|
if count <= 0 then
|
||||||
@@ -545,10 +544,17 @@ function Storage:import(source, slot, count, item)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if count ~= 0 then
|
||||||
|
_G._debug('STORAGE warning: %s(%d): %s -> INSERT failed',
|
||||||
|
item.displayName or item.name, count,
|
||||||
|
self:_sn(source.name))
|
||||||
|
end
|
||||||
|
|
||||||
return total
|
return total
|
||||||
end
|
end
|
||||||
|
|
||||||
-- When importing items into a locked chest, trash any remaining items if full
|
-- When importing items into a locked chest, trash any remaining items if full
|
||||||
|
-- TODO: use all available trashcans
|
||||||
function Storage:trash(source, slot, count, item)
|
function Storage:trash(source, slot, count, item)
|
||||||
local target = Util.find(self.nodes, 'mtype', 'trashcan')
|
local target = Util.find(self.nodes, 'mtype', 'trashcan')
|
||||||
local amount = 0
|
local amount = 0
|
||||||
@@ -569,6 +575,13 @@ function Storage:trash(source, slot, count, item)
|
|||||||
_G._debug(m)
|
_G._debug(m)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if amount ~= count then
|
||||||
|
_G._debug('STORAGE warning: %s(%d): %s -> TRASH failed',
|
||||||
|
item.displayName or item.name, count - amount,
|
||||||
|
self:_sn(source.name))
|
||||||
|
end
|
||||||
|
|
||||||
return amount
|
return amount
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ function ExportTask:cycle(context)
|
|||||||
local _, item = next(items)
|
local _, item = next(items)
|
||||||
if item then
|
if item then
|
||||||
local count = math.min(item.count, itemDB:getMaxCount(item))
|
local count = math.min(item.count, itemDB:getMaxCount(item))
|
||||||
if context.storage:export(node, entry.slot, count, item) ~= count then
|
context.storage:export(node, entry.slot, count, item)
|
||||||
_G._debug('EXPORTER warning: Failed to export %s(%d) %s[%d]',
|
|
||||||
node.displayName or node.name, entry.slot, item.name, count)
|
|
||||||
end
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -70,8 +67,6 @@ function ExportTask:cycle(context)
|
|||||||
if context.storage:export(node, nil, item.count, item) == 0 then
|
if context.storage:export(node, nil, item.count, item) == 0 then
|
||||||
-- TODO: really shouldn't break here as there may be room in other slots
|
-- TODO: really shouldn't break here as there may be room in other slots
|
||||||
-- leaving for now for performance reasons
|
-- leaving for now for performance reasons
|
||||||
_G._debug('EXPORTER warning: Failed to export %s %s[%d]',
|
|
||||||
node.displayName or node.name, item.name, item.count)
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -55,10 +55,7 @@ function ImportTask:cycle(context)
|
|||||||
return node.adapter.getItemMeta(slotNo)
|
return node.adapter.getItemMeta(slotNo)
|
||||||
end)
|
end)
|
||||||
if item and matchesFilter(item) then
|
if item and matchesFilter(item) then
|
||||||
if context.storage:import(node, slotNo, item.count, item) ~= item.count then
|
context.storage:import(node, slotNo, item.count, item)
|
||||||
_G._debug('IMPORTER warning: Failed to import %s(%d) %s[%d]',
|
|
||||||
node.displayName or node.name, slotNo, item.name, item.count)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
local peripheral = _G.peripheral
|
local device = _G.device
|
||||||
|
|
||||||
local ni = peripheral.find('neuralInterface')
|
local kinetic = device['plethora:kinetic'] or
|
||||||
if not ni then
|
|
||||||
error('Missing neural interface')
|
|
||||||
elseif not ni.disableAI then
|
|
||||||
error('Missing kinetic augment')
|
error('Missing kinetic augment')
|
||||||
else
|
|
||||||
ni.disableAI()
|
if not kinetic.disableAI then
|
||||||
|
error('Nope')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
kinetic.disableAI()
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
local peripheral = _G.peripheral
|
local device = _G.device
|
||||||
|
|
||||||
local ni = peripheral.find('neuralInterface')
|
local intro = device['plethora:introspection'] or
|
||||||
if not ni then
|
error('Missing Introspection module')
|
||||||
error('Missing neural interface')
|
|
||||||
elseif not ni.getEquipment then
|
if intro.getBaubles then
|
||||||
error('Missing introspection module')
|
intro.getBaubles().drop(5)
|
||||||
else
|
else
|
||||||
ni.getEquipment().drop(6)
|
intro.getEquipment().drop(6)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,13 +20,32 @@ local function findTargets()
|
|||||||
return l[1]
|
return l[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local last
|
||||||
|
local count = 0
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
local target = findTargets()
|
local target = findTargets()
|
||||||
if target then
|
if target and (not last or Point.distance(last, target) > .2) then
|
||||||
print('looking at ' .. target.name)
|
-- last = target
|
||||||
|
if last then print(Point.distance(last, target)) end
|
||||||
|
last = target
|
||||||
|
--print(target.x, target.y, target.z, count)
|
||||||
ni.lookAt(target)
|
ni.lookAt(target)
|
||||||
|
count = 0
|
||||||
os.sleep(0)
|
os.sleep(0)
|
||||||
|
-- elseif count < 10 then
|
||||||
|
-- count = count + 1
|
||||||
|
-- os.sleep(.1)
|
||||||
|
-- end
|
||||||
else
|
else
|
||||||
|
count = count + 1
|
||||||
|
if count > 50 or not target then
|
||||||
|
ni.lookAt({ x = math.random(-10, 10),
|
||||||
|
y = math.random(-10, 10),
|
||||||
|
z = math.random(-10, 10) })
|
||||||
os.sleep(3)
|
os.sleep(3)
|
||||||
|
else
|
||||||
|
os.sleep(.1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user