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