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:flint", CRUSHER_ADDR},
|
||||||
{"minecraft:nether_bricks", CRUSHER_ADDR},
|
{"minecraft:nether_bricks", CRUSHER_ADDR},
|
||||||
{"minecraft:basalt", CRUSHER_ADDR},
|
{"minecraft:basalt", CRUSHER_ADDR},
|
||||||
{"create:crushed_raw_silver", WASHER_ADDR, 16},
|
{"create:crushed_raw_silver", WASHER_ADDR},
|
||||||
{"minecraft:calcite", CRUSHER_ADDR},
|
{"minecraft:calcite", CRUSHER_ADDR},
|
||||||
{"create:crushed_raw_nickel", WASHER_ADDR, 32},
|
{"create:crushed_raw_nickel", WASHER_ADDR},
|
||||||
{"tfmg:bauxite", CRUSHER_ADDR},
|
{"tfmg:bauxite", CRUSHER_ADDR},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,10 +204,9 @@ end
|
||||||
|
|
||||||
function cycleItems (ticker, items)
|
function cycleItems (ticker, items)
|
||||||
local makeRequest
|
local makeRequest
|
||||||
makeRequest = function (item, amt, addr, limit_override)
|
makeRequest = function (item, amt, addr)
|
||||||
local limit = 64
|
local limit = 64
|
||||||
if addr == MELTER_ADDR then limit = 9 end
|
if addr == MELTER_ADDR then limit = 9 end
|
||||||
if limit_override ~= nil then limit = limit_override end
|
|
||||||
if amt < limit then return end
|
if amt < limit then return end
|
||||||
local request = {
|
local request = {
|
||||||
name = item,
|
name = item,
|
||||||
|
|
@ -218,10 +217,10 @@ function cycleItems (ticker, items)
|
||||||
return makeRequest(item, amt - limit, addr)
|
return makeRequest(item, amt - limit, addr)
|
||||||
end
|
end
|
||||||
for _, pair in pairs(PRODUCTS) do
|
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
|
if items[name] ~= nil then
|
||||||
local amt = items[name]
|
local amt = items[name]
|
||||||
makeRequest(name, amt, addr, limit)
|
makeRequest(name, amt, addr)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -252,10 +251,8 @@ function getNumCraftable (ingredients, current_stock)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function adjustStock (current_stock, ingredients, count)
|
function adjustStock (current_stock, recipe, count)
|
||||||
if count == 0 then return end
|
for _, ingredient in ipairs(recipe.ingredients) do
|
||||||
local item, i_count
|
|
||||||
for _, ingredient in ipairs(ingredients) do
|
|
||||||
item, i_count = ingredient[1], ingredient[2]
|
item, i_count = ingredient[1], ingredient[2]
|
||||||
current_stock[item] = current_stock[item] - (i_count * count)
|
current_stock[item] = current_stock[item] - (i_count * count)
|
||||||
end
|
end
|
||||||
|
|
@ -266,7 +263,7 @@ function craftRecipe (ticker, recipe, current_stock)
|
||||||
if recipe.limit ~= nil then
|
if recipe.limit ~= nil then
|
||||||
count = math.min(count, recipe.limit)
|
count = math.min(count, recipe.limit)
|
||||||
end
|
end
|
||||||
adjustStock(current_stock, recipe.ingredients, count)
|
adjustStock(current_stock, recipe, count)
|
||||||
local createRequest
|
local createRequest
|
||||||
createRequest = function (recipe, i)
|
createRequest = function (recipe, i)
|
||||||
if i == nil then i = 1 end
|
if i == nil then i = 1 end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue