1.7.10 compatibility
This commit is contained in:
@@ -208,6 +208,9 @@ function Craft.getResourceList(inRecipe, items, inCount)
|
|||||||
elseif not summedItem.recipe then
|
elseif not summedItem.recipe then
|
||||||
summedItem.need = 1
|
summedItem.need = 1
|
||||||
need = 1
|
need = 1
|
||||||
|
else
|
||||||
|
summedItem.need = 1
|
||||||
|
need = 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
summedItem.total = summedItem.total + total
|
summedItem.total = summedItem.total + total
|
||||||
|
|||||||
@@ -207,27 +207,30 @@ local function getItems()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function isMachineEmpty(machine, item)
|
local function isMachineEmpty(machine, item)
|
||||||
local side = turtle.getAction(machine.dir).side
|
|
||||||
local methods = Util.transpose(Peripheral.getMethods(side))
|
|
||||||
local list = { true }
|
local list = { true }
|
||||||
|
|
||||||
if methods.getAllStacks then -- 1.7x
|
pcall(function() -- fails randomly in 1.7x
|
||||||
list = Peripheral.call(side, 'getAllStacks', false)
|
local side = turtle.getAction(machine.dir).side
|
||||||
elseif methods.list then
|
local methods = Util.transpose(Peripheral.getMethods(side))
|
||||||
list = Peripheral.call(side, 'list')
|
|
||||||
elseif methods.getProgress then
|
|
||||||
if Peripheral.call(side, 'getProgress') == 0 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
else
|
|
||||||
item.statusCode = STATUS_ERROR
|
|
||||||
item.status = 'Unable to check empty status'
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if tonumber(machine.ignoreSlot) then
|
if methods.getAllStacks then -- 1.7x
|
||||||
list[tonumber(machine.ignoreSlot)] = nil
|
list = Peripheral.call(side, 'getAllStacks', false)
|
||||||
end
|
elseif methods.list then
|
||||||
|
list = Peripheral.call(side, 'list')
|
||||||
|
elseif methods.getProgress then
|
||||||
|
if Peripheral.call(side, 'getProgress') == 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
item.statusCode = STATUS_ERROR
|
||||||
|
item.status = 'Unable to check empty status'
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if tonumber(machine.ignoreSlot) then
|
||||||
|
list[tonumber(machine.ignoreSlot)] = nil
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
if Util.empty(list) then
|
if Util.empty(list) then
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -34,16 +34,17 @@
|
|||||||
from the restocking inventory into the main inventory.
|
from the restocking inventory into the main inventory.
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
Note: computerFacing and inventory are required. All others are optional.
|
|
||||||
|
|
||||||
valid sides:
|
valid sides:
|
||||||
top, bottom, left, right, front, back
|
top, bottom, left, right, front, back
|
||||||
|
|
||||||
valid directions:
|
valid directions:
|
||||||
up, down, north, south, east, west
|
up, down, north, south, east, west
|
||||||
|
|
||||||
|
Required:
|
||||||
computerFacing : direction turtle is facing
|
computerFacing : direction turtle is facing
|
||||||
inventory : side for the main inventory (can be the same as the controller)
|
inventory : side for the main inventory (can be the same as the controller)
|
||||||
|
|
||||||
|
Optional:
|
||||||
craftingChest : side for the chest used for crafting
|
craftingChest : side for the chest used for crafting
|
||||||
controller : side for AE / RS block
|
controller : side for AE / RS block
|
||||||
stock : side for restocking inventory
|
stock : side for restocking inventory
|
||||||
@@ -261,18 +262,6 @@ end
|
|||||||
|
|
||||||
-- Craft
|
-- Craft
|
||||||
local function craftItem(recipe, items, originalItem, craftList, count)
|
local function craftItem(recipe, items, originalItem, craftList, count)
|
||||||
if craftingPaused or not canCraft then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
if not isGridClear() then
|
|
||||||
if not clearGrid() then
|
|
||||||
originalItem.status = 'Grid obstructed'
|
|
||||||
originalItem.statusCode = STATUS_ERROR
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local missing = { }
|
local missing = { }
|
||||||
local toCraft = Craft.getCraftableAmount(recipe, count, items, missing)
|
local toCraft = Craft.getCraftableAmount(recipe, count, items, missing)
|
||||||
if missing.name then
|
if missing.name then
|
||||||
@@ -386,6 +375,28 @@ local function forceCraftItem(inRecipe, items, originalItem, craftList, inCount)
|
|||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function craft(recipe, items, item, craftList)
|
||||||
|
item.status = nil
|
||||||
|
item.statusCode = nil
|
||||||
|
item.crafted = 0
|
||||||
|
|
||||||
|
if craftingPaused or not canCraft then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not clearGrid() then
|
||||||
|
item.status = 'Grid obstructed'
|
||||||
|
item.statusCode = STATUS_ERROR
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if item.forceCrafting then
|
||||||
|
item.crafted = forceCraftItem(recipe, items, item, craftList, item.count)
|
||||||
|
else
|
||||||
|
item.crafted = craftItem(recipe, items, item, craftList, item.count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function craftItems(craftList, allItems)
|
local function craftItems(craftList, allItems)
|
||||||
-- turtle crafting
|
-- turtle crafting
|
||||||
if canCraft then
|
if canCraft then
|
||||||
@@ -393,13 +404,7 @@ local function craftItems(craftList, allItems)
|
|||||||
local item = craftList[key]
|
local item = craftList[key]
|
||||||
local recipe = Craft.recipes[key]
|
local recipe = Craft.recipes[key]
|
||||||
if recipe then
|
if recipe then
|
||||||
item.status = nil
|
craft(recipe, allItems, item, craftList)
|
||||||
item.statusCode = nil
|
|
||||||
if item.forceCrafting then
|
|
||||||
item.crafted = forceCraftItem(recipe, allItems, item, craftList, item.count)
|
|
||||||
else
|
|
||||||
item.crafted = craftItem(recipe, allItems, item, craftList, item.count)
|
|
||||||
end
|
|
||||||
allItems = listItems() -- refresh counts
|
allItems = listItems() -- refresh counts
|
||||||
if not allItems then
|
if not allItems then
|
||||||
break
|
break
|
||||||
|
|||||||
2855
etc/recipes/skyblockinfinity.db
Normal file
2855
etc/recipes/skyblockinfinity.db
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user