This commit is contained in:
Brevven 2022-01-05 20:49:09 -08:00
parent ef7938c65f
commit 934ae363fa
2 changed files with 49 additions and 7 deletions

View file

@ -8,6 +8,15 @@ local util = {}
util.me = me util.me = me
util.get_setting = util.me.get_setting util.get_setting = util.me.get_setting
util.titanium_plate = ""
util.titanium_processing = ""
if mods["FactorioExtended-Plus-Core"] then
util.titanium_plate = "titanium-alloy"
else
util.titanium_plate = "titanium-plate"
end
function util.fe_plus(sub) function util.fe_plus(sub)
if mods["FactorioExtended-Plus-"..sub] then if mods["FactorioExtended-Plus-"..sub] then
return true return true
@ -334,7 +343,7 @@ function util.remove_raw(t, name)
end end
-- Multiply energy required -- Multiply energy required
function util.multiply_time(recipe, factor) function util.multiply_time(recipe_name, factor)
if me.bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
multiply_time(data.raw.recipe[recipe_name], factor) multiply_time(data.raw.recipe[recipe_name], factor)
@ -351,19 +360,40 @@ function multiply_time(recipe, factor)
end end
end end
-- Set recipe category -- Add to energy required
function util.set_category(recipe, category) function util.add_time(recipe_name, amount)
log("Doing ".. recipe_name)
log(amount)
if me.bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe] then log(1)
data.raw.recipe[recipe].category = category if data.raw.recipe[recipe_name] then
add_time(data.raw.recipe[recipe_name], amount)
add_time(data.raw.recipe[recipe_name].normal, amount)
add_time(data.raw.recipe[recipe_name].expensive, amount)
end
end
function add_time(recipe, amount)
if recipe then
if recipe.energy_required then
recipe.energy_required = recipe.energy_required + amount
end
end
end
-- Set recipe category
function util.set_category(recipe_name, category)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then
data.raw.recipe[recipe_name].category = category
end end
end end
-- Set recipe subgroup -- Set recipe subgroup
function util.set_subgroup(recipe, subgroup) function util.set_subgroup(recipe_name, subgroup)
if me.bypass[recipe_name] then return end if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe] then if data.raw.recipe[recipe_name] then
data.raw.recipe[recipe].subgroup = subgroup data.raw.recipe[recipe_name].subgroup = subgroup
end end
end end
@ -435,4 +465,10 @@ function add_to_product(recipe, product, amount)
end end
end end
function util.add_minable_result(t, name, result)
if data.raw[t] and data.raw[t][name] and data.raw[t][name].minable and data.raw[t][name].minable.results then
table.insert(data.raw[t][name].minable.results, result)
end
end
return util return util

6
me.lua
View file

@ -35,4 +35,10 @@ if me.get_setting(me.name.."-recipe-bypass") then
end end
end end
function me.add_modified(name)
if me.get_setting(me.name.."-list") then
table.insert(me.list, name)
end
end
return me return me