Compare commits
No commits in common. "139164077c20f7fd94faa9b10bd6010f46a8d1bd" and "04f6d66e5647d442d7aff19ffa356086286b11a3" have entirely different histories.
139164077c
...
04f6d66e56
1 changed files with 8 additions and 11 deletions
|
|
@ -70,9 +70,9 @@ local PRODUCTS = {
|
|||
{"minecraft:flint", CRUSHER_ADDR},
|
||||
{"minecraft:nether_bricks", CRUSHER_ADDR},
|
||||
{"minecraft:basalt", CRUSHER_ADDR},
|
||||
{"create:crushed_raw_silver", WASHER_ADDR, 16},
|
||||
{"create:crushed_raw_silver", WASHER_ADDR},
|
||||
{"minecraft:calcite", CRUSHER_ADDR},
|
||||
{"create:crushed_raw_nickel", WASHER_ADDR, 32},
|
||||
{"create:crushed_raw_nickel", WASHER_ADDR},
|
||||
{"tfmg:bauxite", CRUSHER_ADDR},
|
||||
}
|
||||
|
||||
|
|
@ -204,10 +204,9 @@ end
|
|||
|
||||
function cycleItems (ticker, items)
|
||||
local makeRequest
|
||||
makeRequest = function (item, amt, addr, limit_override)
|
||||
makeRequest = function (item, amt, addr)
|
||||
local limit = 64
|
||||
if addr == MELTER_ADDR then limit = 9 end
|
||||
if limit_override ~= nil then limit = limit_override end
|
||||
if amt < limit then return end
|
||||
local request = {
|
||||
name = item,
|
||||
|
|
@ -218,10 +217,10 @@ function cycleItems (ticker, items)
|
|||
return makeRequest(item, amt - limit, addr)
|
||||
end
|
||||
for _, pair in pairs(PRODUCTS) do
|
||||
local name, addr, limit = pair[1], pair[2], pair[3]
|
||||
local name, addr = pair[1], pair[2]
|
||||
if items[name] ~= nil then
|
||||
local amt = items[name]
|
||||
makeRequest(name, amt, addr, limit)
|
||||
makeRequest(name, amt, addr)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -252,10 +251,8 @@ function getNumCraftable (ingredients, current_stock)
|
|||
return result
|
||||
end
|
||||
|
||||
function adjustStock (current_stock, ingredients, count)
|
||||
if count == 0 then return end
|
||||
local item, i_count
|
||||
for _, ingredient in ipairs(ingredients) do
|
||||
function adjustStock (current_stock, recipe, count)
|
||||
for _, ingredient in ipairs(recipe.ingredients) do
|
||||
item, i_count = ingredient[1], ingredient[2]
|
||||
current_stock[item] = current_stock[item] - (i_count * count)
|
||||
end
|
||||
|
|
@ -266,7 +263,7 @@ function craftRecipe (ticker, recipe, current_stock)
|
|||
if recipe.limit ~= nil then
|
||||
count = math.min(count, recipe.limit)
|
||||
end
|
||||
adjustStock(current_stock, recipe.ingredients, count)
|
||||
adjustStock(current_stock, recipe, count)
|
||||
local createRequest
|
||||
createRequest = function (recipe, i)
|
||||
if i == nil then i = 1 end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue