milo wip
This commit is contained in:
@@ -13,7 +13,6 @@ function NetworkedAdapter:init(args)
|
||||
dirty = true,
|
||||
listCount = 0,
|
||||
activity = { },
|
||||
nameArray = { },
|
||||
}
|
||||
Util.merge(self, defaults)
|
||||
Util.merge(self, args)
|
||||
@@ -30,7 +29,6 @@ listCount = 0,
|
||||
local adapter = InventoryAdapter.wrap({ side = k, direction = self.localName })
|
||||
if adapter then
|
||||
table.insert(self.remotes, adapter)
|
||||
self.nameArray[adapter.direction] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -49,7 +47,6 @@ listCount = 0,
|
||||
return a.priority > b.priority
|
||||
end)
|
||||
end
|
||||
debug(self.nameArray)
|
||||
end
|
||||
|
||||
function NetworkedAdapter:isValid()
|
||||
@@ -113,7 +110,6 @@ function NetworkedAdapter:getItemInfo(item)
|
||||
end
|
||||
|
||||
function NetworkedAdapter:provide(item, qty, slot, direction)
|
||||
local key = table.concat({ item.name, item.damage, item.nbtHash }, ':')
|
||||
local total = 0
|
||||
|
||||
for _, remote in ipairs(self.remotes) do
|
||||
@@ -124,10 +120,6 @@ debug('EXT: %s(%d): %s -> %s%s',
|
||||
slot and string.format('[%d]', slot) or '')
|
||||
self.dirty = true
|
||||
remote.dirty = true
|
||||
--if self.nameArray[direction or self.localName] then
|
||||
-- local entry = self.activity[key] or 0
|
||||
-- self.activity[key] = entry + amount
|
||||
--end
|
||||
end
|
||||
qty = qty - amount
|
||||
total = total + amount
|
||||
@@ -179,10 +171,8 @@ debug('INS: %s(%d): %s[%d] -> %s',
|
||||
self.dirty = true
|
||||
remote.dirty = true
|
||||
debug('insert: ' .. (source or self.localName))
|
||||
--if self.nameArray[source or self.localName] then
|
||||
local entry = self.activity[key] or 0
|
||||
self.activity[key] = entry + amount
|
||||
--end
|
||||
local entry = self.activity[key] or 0
|
||||
self.activity[key] = entry + amount
|
||||
end
|
||||
qty = qty - amount
|
||||
total = total + amount
|
||||
|
||||
@@ -64,7 +64,6 @@ local function machineCraft(recipe, qty, inventoryAdapter, machineName, oitem)
|
||||
local key = recipe.result
|
||||
local request = oitem.ingredients[key]
|
||||
|
||||
debug('requested: ' .. key)
|
||||
if not request then
|
||||
request = {
|
||||
count = qty,
|
||||
@@ -75,7 +74,6 @@ debug('requested: ' .. key)
|
||||
|
||||
if request.pending then
|
||||
request.crafted = request.crafted + (inventoryAdapter.activity[key] or 0)
|
||||
debug({ request.crafted, request.count })
|
||||
if request.crafted >= request.count then
|
||||
request.pending = nil -- TODO: check...
|
||||
request.statusCode = Craft.STATUS_SUCCESS
|
||||
@@ -100,8 +98,6 @@ debug({ request.crafted, request.count })
|
||||
end
|
||||
end
|
||||
|
||||
debug('processing %s %d', key, qty)
|
||||
|
||||
for k,v in pairs(recipe.ingredients) do
|
||||
if inventoryAdapter:provide(splitKey(v), qty, k, machineName) ~= qty then
|
||||
-- TODO: suck em back out
|
||||
@@ -119,7 +115,6 @@ local function turtleCraft(recipe, qty, inventoryAdapter, oitem)
|
||||
local key = recipe.result
|
||||
local request = oitem.ingredients[key]
|
||||
|
||||
debug('requested: ' .. key)
|
||||
if not request then
|
||||
request = {
|
||||
count = qty,
|
||||
|
||||
Reference in New Issue
Block a user