Compare commits

..

No commits in common. "04f6d66e5647d442d7aff19ffa356086286b11a3" and "c9e50405aae96c0e7b58dfb91151fb2914136cc0" have entirely different histories.

View file

@ -24,10 +24,6 @@ local KEEP_STOCKED = {
["minecraft:gravel"] = 0, ["minecraft:gravel"] = 0,
["minecraft:netherite_scrap"] = 4, ["minecraft:netherite_scrap"] = 4,
["minecraft:nether_bricks"] = 0, ["minecraft:nether_bricks"] = 0,
["oreganized:silver_nugget"] = 4 * 64,
["tfmg:nickel_nugget"] = 4 * 64,
["tfmg:lithium_nugget"] = 64,
["tfmg:bauxite_powder"] = 4 * 64,
} }
local GLOBAL_LIMS = { local GLOBAL_LIMS = {
@ -48,10 +44,6 @@ local LIMIT_EXCEPTIONS = {
lower = 0, lower = 0,
upper = 4, upper = 4,
}, },
["tfmg:lithium_nugget"] = {
lower = -1,
upper = 0,
},
} }
-- if these exist, they will be used up -- if these exist, they will be used up
@ -69,11 +61,6 @@ local PRODUCTS = {
{"minecraft:brick", HAUNTER_ADDR}, {"minecraft:brick", HAUNTER_ADDR},
{"minecraft:flint", CRUSHER_ADDR}, {"minecraft:flint", CRUSHER_ADDR},
{"minecraft:nether_bricks", CRUSHER_ADDR}, {"minecraft:nether_bricks", CRUSHER_ADDR},
{"minecraft:basalt", CRUSHER_ADDR},
{"create:crushed_raw_silver", WASHER_ADDR},
{"minecraft:calcite", CRUSHER_ADDR},
{"create:crushed_raw_nickel", WASHER_ADDR},
{"tfmg:bauxite", CRUSHER_ADDR},
} }
-- these will be crafted when needed -- these will be crafted when needed
@ -139,27 +126,6 @@ local RECIPES = {
}, },
addr = PRESS_ADDR, addr = PRESS_ADDR,
}, },
["oreganized:silver_nugget"] = {
ingredients = {
{"oreganized:silver_nugget", 60},
{"minecraft:gravel", 24},
},
addr = PRESS_ADDR,
},
["tfmg:nickel_nugget"] = {
ingredients = {
{"tfmg:nickel_nugget", 64},
{"minecraft:gravel", 64},
},
addr = PRESS_ADDR,
},
["tfmg:bauxite_powder"] = {
ingredients = {
{"tfmg:bauxite_powder", 64},
{"minecraft:gravel", 64},
},
addr = PRESS_ADDR,
},
} }
local SLEEP_T = 20 local SLEEP_T = 20
@ -251,19 +217,11 @@ function getNumCraftable (ingredients, current_stock)
return result return result
end end
function adjustStock (current_stock, recipe, count) function craftRecipe (ticker, recipe, count)
for _, ingredient in ipairs(recipe.ingredients) do if count == nil then count = 1 end
item, i_count = ingredient[1], ingredient[2]
current_stock[item] = current_stock[item] - (i_count * count)
end
end
function craftRecipe (ticker, recipe, current_stock)
local count = getNumCraftable(recipe.ingredients, 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, 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
@ -305,7 +263,8 @@ function run (ticker, export_storage, current_modes)
if mode[1] == "recipe" then if mode[1] == "recipe" then
-- make as many recipes as you can with current stock -- make as many recipes as you can with current stock
local recipe = RECIPES[item] local recipe = RECIPES[item]
craftRecipe(ticker, recipe, stock_amounts) local count = getNumCraftable(recipe.ingredients, stock_amounts)
craftRecipe(ticker, recipe, count)
elseif mode[1] == "export" then elseif mode[1] == "export" then
local export_amt = export_amounts[item] local export_amt = export_amounts[item]
if export_amt == nil then export_amt = 0 end if export_amt == nil then export_amt = 0 end