1.7.10 compatibility

This commit is contained in:
kepler155c
2018-02-24 15:02:56 -05:00
parent 3926ee1705
commit 2bf2e41ee6
2 changed files with 17 additions and 12 deletions

View File

@@ -1078,8 +1078,9 @@ function listingPage:applyFilter()
end end
-- randomly errors in 1.7x with "you are not attached to this computer" -- randomly errors in 1.7x with "you are not attached to this computer"
print('Inspecting machines')
local retryCount = 0 local retryCount = 0
for _ = 1, 3 do while true do
Util.clear(machines) Util.clear(machines)
local s, m = pcall(findMachines) local s, m = pcall(findMachines)
if not s and m then if not s and m then

View File

@@ -2,7 +2,7 @@
Provides: autocrafting, resource limits, on-demand crafting, storage stocker. Provides: autocrafting, resource limits, on-demand crafting, storage stocker.
Using a turtle allows for crafting of items eliminating the need for AE/RS Using a turtle allows for crafting of items eliminating the need for AE/RS
molecular assemblers. molecular assemblers / crafters.
Inventory setup: Inventory setup:
Turtle/computer must be touching at least one type of inventory Turtle/computer must be touching at least one type of inventory
@@ -24,19 +24,25 @@
2. Requires a vanilla chest beside the turtle with the "craftingChest" 2. Requires a vanilla chest beside the turtle with the "craftingChest"
configuration variable defined. configuration variable defined.
-- or -- -- or --
If using MC 1.7x, you can use a duck antenna instead. If using MC 1.7x, you can equip the turtle with a duck antenna.
Restocking: Restocking:
If using a limited inventory block, such as RFTools modular storage, you If using a limited inventory block, such as RFTools modular storage, you
can have the main inventory automatically replenish items from the restocking can have the main inventory automatically replenish items from the restocking
inventory. Each cycle, the restocking inventory will be checked and if the inventory. Each cycle, the restocking inventory will be checked and if the
main inventory has less than a stock of an item, it will pull that item main inventory has less than a stack of an item, it will pull that item
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. Note: computerFacing and inventory are required. All others are optional.
computerFacing : the direction turtle is facing valid sides:
top, bottom, left, right, front, back
valid directions:
up, down, north, south, east, west
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)
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
@@ -48,7 +54,6 @@
type/monitor - will use the first monitor found type/monitor - will use the first monitor found
side/north - specify a direction (top/bottom/east/etc) side/north - specify a direction (top/bottom/east/etc)
name/monitor_1 - specify the exact name of the peripheral name/monitor_1 - specify the exact name of the peripheral
]]-- ]]--
_G.requireInjector() _G.requireInjector()
@@ -254,8 +259,8 @@ local function addCraftingRequest(item, craftList, count)
return request return request
end end
-- Craft
local function craftItem(recipe, items, originalItem, craftList, count) local function craftItem(recipe, items, originalItem, craftList, count)
if craftingPaused or not canCraft then if craftingPaused or not canCraft then
return 0 return 0
end end
@@ -302,6 +307,7 @@ local function craftItem(recipe, items, originalItem, craftList, count)
return crafted return crafted
end end
-- Craft as much as possible regardless if all ingredients are available
local function forceCraftItem(inRecipe, items, originalItem, craftList, inCount) local function forceCraftItem(inRecipe, items, originalItem, craftList, inCount)
local summed = { } local summed = { }
local throttle = Util.throttle() local throttle = Util.throttle()
@@ -462,9 +468,8 @@ local function restock()
if items and stock then if items and stock then
for _,v in pairs(stock) do for _,v in pairs(stock) do
local count = Craft.getItemCount(items, v) local count = Craft.getItemCount(items, v)
if count < 64 then if count < v.maxCount then
count = 64 - count stockAdapter:provide(v, v.maxCount - count)
stockAdapter:provide(v, count)
clearGrid() clearGrid()
end end
end end
@@ -1357,6 +1362,7 @@ jobMonitor()
Event.onInterval(5, function() Event.onInterval(5, function()
if not craftingPaused then if not craftingPaused then
restock()
local items = listItems() local items = listItems()
if not items or Util.size(items) == 0 then if not items or Util.size(items) == 0 then
jobList:showError('No items in system') jobList:showError('No items in system')
@@ -1401,8 +1407,6 @@ Event.onInterval(5, function()
craftList = getAutocraftItems(items) -- autocrafted items don't show on job monitor craftList = getAutocraftItems(items) -- autocrafted items don't show on job monitor
craftItems(craftList, items) craftItems(craftList, items)
restock()
end end
end end
end) end)