diff --git a/PHI-CL/config.lua b/PHI-CL/config.lua index d683a87..9dbeb77 100644 --- a/PHI-CL/config.lua +++ b/PHI-CL/config.lua @@ -382,11 +382,11 @@ local items = { ['electric-filter-furnace'] = { enabled = settings.startup['PHI-MB'].value, stage = 2, - type = 'assembling-machine', + type = 'furnace', name = 'electric-filter-furnace', - ref_name = 'electric-filter-furnace', + ref_name = 'electric-furnace', tech = 'advanced-material-processing-2', - min = 2, + min = 1, max = 3 }, ['laser-turret'] = { diff --git a/PHI-CL/data.lua b/PHI-CL/data.lua index a92eaff..92dee93 100644 --- a/PHI-CL/data.lua +++ b/PHI-CL/data.lua @@ -45,3 +45,196 @@ for _, v in pairs(items['equipment']) do end end end + +if settings.startup['PHI-RS-RECIPE-DROF'].value == 1 then + data.raw['utility-constants'].default.dynamic_recipe_overload_factor = 1.17 + +else + data.raw['utility-constants'].default.dynamic_recipe_overload_factor = settings.startup['PHI-RS-RECIPE-DROF'].value +end + +data.raw['utility-constants'].default.minimum_recipe_overload_multiplier = settings.startup['PHI-RS-RECIPE-MINROM'].value +data.raw['utility-constants'].default.maximum_recipe_overload_multiplier = settings.startup['PHI-RS-RECIPE-MAXROM'].value + + +if settings.startup['PHI-RS-MODULE'].value then + table.insert(items, { + name='speed-module', + tech='speed-module' + }) + table.insert(items, { + name='speed-module-2', + tech='speed-module-2' + }) + table.insert(items, { + name='speed-module-3', + tech='speed-module-3' + }) + table.insert(items, { + name='productivity-module', + tech='productivity-module' + }) + table.insert(items, { + name='productivity-module-2', + tech='productivity-module-2' + }) + table.insert(items, { + name='productivity-module-3', + tech='productivity-module-3' + }) + table.insert(items, { + name='effectivity-module', + tech='effectivity-module' + }) + table.insert(items, { + name='effectivity-module-2', + tech='effectivity-module-2' + }) + table.insert(items, { + name='effectivity-module-3', + tech='effectivity-module-3' + }) +end + +local recipe_multiplier = {settings.startup['PHI-RS-RECIPE-1'].value, settings.startup['PHI-RS-RECIPE-2'].value} + +for j=1, 2, 1 do + if recipe_multiplier[j] ~= 1 then + for i=1, #items, 1 do + if data.raw.recipe[items[i].name] then + local item = table.deepcopy(data.raw.recipe[items[i].name]) + item.enabled = false + + if item.normal and item.normal then + for k, v in pairs(item.normal.ingredients) do + if v[1] and v[2] then + item.normal.ingredients[k][2] = v[2] * recipe_multiplier[j] + + else + item.normal.ingredients[k].amount = v.amount * recipe_multiplier[j] + end + end + + if item.normal.results then + for k, v in pairs(item.normal.results) do + if v[1] and v[2] then + item.normal.results[k][2] = v[2] * recipe_multiplier[j] + + else + item.normal.results[k].amount = v.amount * recipe_multiplier[j] + end + end + + else + if item.normal.result_count then + item.normal.result_count = item.normal.result_count * recipe_multiplier[j] + + else + item.normal.result_count = recipe_multiplier[j] + end + end + + if item.normal.energy_required then + item.normal.energy_required = item.normal.energy_required * recipe_multiplier[j] + + else + item.normal.energy_required = recipe_multiplier[j] / 2 + end + + elseif item.expensive and item.expensive then + for k, v in pairs(item.expensive.ingredients) do + if v[1] and v[2] then + item.expensive.ingredients[k][2] = v[2] * recipe_multiplier[j] + + else + item.expensive.ingredients[k].amount = v.amount * recipe_multiplier[j] + end + end + + if item.expensive.results then + for k, v in pairs(item.expensive.results) do + if v[1] and v[2] then + item.expensive.results[k][2] = v[2] * recipe_multiplier[j] + + else + item.expensive.results[k].amount = v.amount * recipe_multiplier[j] + end + end + + else + if item.expensive.result_count then + item.expensive.result_count = item.expensive.result_count * recipe_multiplier[j] + + else + item.expensive.result_count = recipe_multiplier[j] + end + end + + if item.expensive.energy_required then + item.expensive.energy_required = item.expensive.energy_required * recipe_multiplier[j] + + else + item.expensive.energy_required = recipe_multiplier[j] / 2 + end + + else + for k, v in pairs(item.ingredients) do + if v[1] and v[2] then + item.ingredients[k][2] = v[2] * recipe_multiplier[j] + + else + item.ingredients[k].amount = v.amount * recipe_multiplier[j] + end + end + + if item.results then + for k, v in pairs(item.results) do + if v[1] and v[2] then + item.results[k][2] = v[2] * recipe_multiplier[j] + + else + item.results[k].amount = v.amount * recipe_multiplier[j] + end + end + + else + if item.result_count then + item.result_count = item.result_count * recipe_multiplier[j] + + else + item.result_count = recipe_multiplier[j] + end + end + + if item.energy_required then + item.energy_required = item.energy_required * recipe_multiplier[j] + + else + item.energy_required = recipe_multiplier[j] / 2 + end + end + + item.name = item.name .. '-s' .. j + + data:extend({item}) + table.insert(data.raw.technology[items[i].tech].effects, {type='unlock-recipe', recipe=item.name}) + end + end + end +end + +local module_limitation = table.deepcopy(data.raw.module['productivity-module']['limitation']) + +if module_limitation then + for _, v in pairs(data.raw.module) do + if v.limitation and string.find(v.name, 'productivity', 1, true) then + for j=1, #recipe_multiplier, 1 do + for k, _ in pairs(module_limitation) do + if data.raw.recipe[module_limitation[k] .. '-s' .. j] ~= nil then + table.insert(v.limitation, module_limitation[k] .. '-s' .. j) + end + end + end + end + end +end diff --git a/PHI-CL/main.lua b/PHI-CL/main.lua index 272d209..1594dbd 100644 --- a/PHI-CL/main.lua +++ b/PHI-CL/main.lua @@ -7,8 +7,15 @@ local main = {} function main.EEE(source, tier) local item = table.deepcopy(data.raw[source.type][source.ref_name]) - item.name = source.name .. '-' .. tier - item.minable.result = source.name .. '-' .. tier + if tier > 1 then + item.name = source.name + item.minable.result = source.name + + else + item.name = source.name .. '-' .. tier + item.minable.result = source.name .. '-' .. tier + end + item.max_health = item.max_health * (2 ^ (tier - source.min + 1)) if item.energy_usage then @@ -118,6 +125,10 @@ function main.EEE(source, tier) end end + if source.name == 'electric-filter-furnace' then + item.type = 'assembling-machine' + end + -- item.animation.layers[1].filename = graphics_location .. source .. '-e.png' -- item.animation.layers[1].hr_version.filename = graphics_location .. source ..'-eh.png' -- item.icon = graphics_location .. source .. '-i.png' @@ -224,10 +235,15 @@ function main.EI(source, tier) -- item.icons = {{icon = '__base__/graphics/icons/' .. source.graphics_name .. '.png', icon_mipmaps = 4, icon_size = 64}} else - item.name = source.name .. '-' .. tier - item.place_result = source.name .. '-' .. tier + if tier > 1 then + item.name = source.name .. '-' .. tier + item.place_result = source.name .. '-' .. tier - -- item.icons = {{icon = graphics_location .. source.name .. '-i.png', icon_mipmaps = 4, icon_size = 64}} + else + item.name = source.name + item.place_result = source.name + -- item.icons = {{icon = graphics_location .. source.name .. '-i.png', icon_mipmaps = 4, icon_size = 64}} + end end item.order = item.order .. tier @@ -276,6 +292,25 @@ function main.ER(source, tier) result = result_name, }}) + elseif source.name == 'electric-filter-furnace' and tier == 1 then + data:extend({{ + type = 'recipe', + name = 'electric-filter-furnace', + energy_required = 2, + enabled = false, + ingredients = {{'electric-furnace', 1}}, + result = 'electric-filter-furnace', + }}) + + data:extend({{ + type = 'recipe', + name = 'electric-furnace-return', + energy_required = 2, + enabled = false, + ingredients = {{'electric-filter-furnace', 1}}, + result = 'electric-furnace', + }}) + else data:extend({{ type = 'recipe', diff --git a/PHI-RS/data.lua b/PHI-RS/data.lua index 6a689f4..3d8ce75 100644 --- a/PHI-RS/data.lua +++ b/PHI-RS/data.lua @@ -201,7 +201,7 @@ local function EE(source) -- item.icon_size = 64 -- item.icon_mipmaps = 4 - if (source.new_type ~= nil) then + if source.new_type then item.type = source.new_type end @@ -214,7 +214,6 @@ local function EI(source) item.name = source.name item.place_result = source.name - -- item.icons = {{icon = graphics_location .. source .. '-i.png', icon_mipmaps = 4, icon_size = 64}} item.order = item.order .. 'B' data:extend({item}) end