plethora import/export support
This commit is contained in:
@@ -348,23 +348,25 @@ function TurtleBuilder:dumpInventoryWithCheck()
|
||||
end
|
||||
|
||||
function TurtleBuilder:autocraft(supplies)
|
||||
local t = { }
|
||||
if self.itemAdapter.craftItems then
|
||||
local t = { }
|
||||
|
||||
for _,s in pairs(supplies) do
|
||||
local key = s.id .. ':' .. s.dmg
|
||||
local item = t[key]
|
||||
if not item then
|
||||
item = {
|
||||
id = s.id,
|
||||
dmg = s.dmg,
|
||||
qty = 0,
|
||||
}
|
||||
t[key] = item
|
||||
for _,s in pairs(supplies) do
|
||||
local key = s.id .. ':' .. s.dmg
|
||||
local item = t[key]
|
||||
if not item then
|
||||
item = {
|
||||
id = s.id,
|
||||
dmg = s.dmg,
|
||||
qty = 0,
|
||||
}
|
||||
t[key] = item
|
||||
end
|
||||
item.qty = item.qty + (s.need - s.qty)
|
||||
end
|
||||
item.qty = item.qty + (s.need - s.qty)
|
||||
end
|
||||
|
||||
self.itemAdapter:craftItems(convertForward(t))
|
||||
self.itemAdapter:craftItems(convertForward(t))
|
||||
end
|
||||
end
|
||||
|
||||
function TurtleBuilder:getSupplies()
|
||||
|
||||
@@ -122,12 +122,6 @@ function ChestAdapter:getItemInfo(item)
|
||||
return self.cache[key]
|
||||
end
|
||||
|
||||
function ChestAdapter:craft()
|
||||
end
|
||||
|
||||
function ChestAdapter:craftItems()
|
||||
end
|
||||
|
||||
function ChestAdapter:provide(item, qty, slot, direction)
|
||||
pcall(function()
|
||||
for key,stack in Util.rpairs(self.getAllStacks(false)) do
|
||||
|
||||
@@ -113,12 +113,6 @@ function ChestAdapter:getItemInfo(item)
|
||||
return self.cache[key]
|
||||
end
|
||||
|
||||
function ChestAdapter:craft()
|
||||
end
|
||||
|
||||
function ChestAdapter:craftItems()
|
||||
end
|
||||
|
||||
function ChestAdapter:getPercentUsed()
|
||||
if self.cache and self.getDrawerCount then
|
||||
return math.floor(Util.size(self.cache) / self.getDrawerCount() * 100)
|
||||
|
||||
@@ -377,7 +377,7 @@ function listingPage:eventHandler(event)
|
||||
if item and item.is_craftable then
|
||||
local qty = math.max(0, s.need - item.qty)
|
||||
|
||||
if item then
|
||||
if item and Builder.itemAdapter.craftItems then
|
||||
Builder.itemAdapter:craftItems({{ name = s.id, damage = s.dmg, nbtHash = s.nbt_hash, count = qty }})
|
||||
local name = s.display_name or s.id
|
||||
self.statusBar:timedStatus('Requested ' .. qty .. ' ' .. name, 3)
|
||||
|
||||
Reference in New Issue
Block a user