diff --git a/PHI-CL/config.lua b/PHI-CL/config.lua index 88b8062..7233cdf 100644 --- a/PHI-CL/config.lua +++ b/PHI-CL/config.lua @@ -2,6 +2,16 @@ local items = { ['general'] = { ['graphics_location'] = '__PHI-CL__/graphics/' }, + ['handle'] = { + [2] = { + ['item'] = false, + ['equipment'] = false, + }, + [3] = { + ['item'] = false, + ['equipment'] = false, + } + }, ['research_modifier'] = { --[[ ['electric-turret'] = { diff --git a/PHI-CL/data-updates.lua b/PHI-CL/data-updates.lua index 48d5adc..7902880 100644 --- a/PHI-CL/data-updates.lua +++ b/PHI-CL/data-updates.lua @@ -2,93 +2,34 @@ local items = require 'config' local main = require 'main' local file_stage = 2 -if mods['space-age'] then - if settings.startup['PHI-CT'].value then - if settings.startup['PHI-CT-HIDDEN'].value then - data.raw.recipe['turbo-loader'].hidden = false - table.insert(data.raw.technology['turbo-transport-belt'].effects, {type='unlock-recipe', recipe='turbo-loader'}) - end +if items['handle'][file_stage]['item'] then + for _, v in pairs(items['item']) do + if (v.stage == file_stage) and v.enabled and (v.max >= v.min) then + v.category = 'item' - if not settings.startup['PHI-CT-SPOIL'].value then - local function spoil_handle(i) - i.spoil_ticks = nil - i.spoil_result = nil - i.spoil_to_trigger_result = nil + for j=v.min, v.max, 1 do + main.EEE(v, j) + main.EI(v, j) + main.ER(v, j) + main.ET(v, j) end - -- spoil_handle(data.raw['item']['iron-bacteria']) - -- spoil_handle(data.raw['item']['copper-bacteria']) - spoil_handle(data.raw['item']['nutrients']) - spoil_handle(data.raw['item']['captive-biter-spawner']) - spoil_handle(data.raw['item']['biter-egg']) - spoil_handle(data.raw['item']['pentapod-egg']) - spoil_handle(data.raw['capsule']['raw-fish']) - spoil_handle(data.raw['capsule']['yumako-mash']) - spoil_handle(data.raw['capsule']['yumako']) - spoil_handle(data.raw['capsule']['jelly']) - spoil_handle(data.raw['capsule']['jellynut']) - spoil_handle(data.raw['capsule']['bioflux']) - spoil_handle(data.raw['tool']['agricultural-science-pack']) - - data:extend({{ - type = 'recipe', - name = 'spoilage-from-nutrients', - energy_required = 1, - enabled = false, - ingredients = {{type='item', name='nutrients', amount=1}}, - results = {{type='item', name='spoilage', amount=10}}, - main_product = 'spoilage', - localised_name = {'phi-cl.combine', data.raw['item']['spoilage'].localised_name, ''} - }}) - - table.insert(data.raw.technology['agriculture'].effects, {type='unlock-recipe', recipe='spoilage-from-nutrients'}) - end - - if settings.startup['PHI-CT-SA'].value then - data:extend({{ - type = 'recipe', - name = 'cliff-explosives-o', - energy_required = 1, - enabled = false, - ingredients = { - {type='item', name='explosives', amount=10}, - {type='item', name='grenade', amount=1}, - {type='item', name='barrel', amount=1} - }, - results = {{type='item', name='cliff-explosives', amount=1}}, - main_product = 'cliff-explosives', - localised_name = data.raw['recipe']['cliff-explosives'].localised_name - }}) - - table.insert(data.raw.technology['cliff-explosives'].effects, {type='unlock-recipe', recipe='cliff-explosives-o'}) + main.EL(v) end end end -for _, v in pairs(items['item']) do - if (v.stage == file_stage) and v.enabled and (v.max >= v.min) then - v.category = 'item' +if items['handle'][file_stage]['equipment'] then + for _, v in pairs(items['equipment']) do + if (v.stage == file_stage) and v.enabled and (v.max >= v.min) then + v.category = 'equipment' - for j=v.min, v.max, 1 do - main.EEE(v, j) - main.EI(v, j) - main.ER(v, j) - main.ET(v, j) - end - - main.EL(v) - end -end - -for _, v in pairs(items['equipment']) do - if (v.stage == file_stage) and v.enabled and (v.max >= v.min) then - v.category = 'equipment' - - for j=v.min, v.max, 1 do - main.EEQ(v, j) - main.EI(v, j) - main.ER(v, j) - main.ET(v, j) + for j=v.min, v.max, 1 do + main.EEQ(v, j) + main.EI(v, j) + main.ER(v, j) + main.ET(v, j) + end end end end diff --git a/PHI-CL/data.lua b/PHI-CL/data.lua index 6bcd926..f7310ff 100644 --- a/PHI-CL/data.lua +++ b/PHI-CL/data.lua @@ -626,6 +626,74 @@ if settings.startup['PHI-CT'].value then table.insert(data.raw.technology['logistics'].effects, {type='unlock-recipe', recipe='loader'}) table.insert(data.raw.technology['logistics-2'].effects, {type='unlock-recipe', recipe='fast-loader'}) table.insert(data.raw.technology['logistics-3'].effects, {type='unlock-recipe', recipe='express-loader'}) + + if mods['space-age'] then + data.raw.recipe['turbo-loader'].hidden = false + table.insert(data.raw.technology['turbo-transport-belt'].effects, {type='unlock-recipe', recipe='turbo-loader'}) + end + end + + if not settings.startup['PHI-CT-SPOIL'].value then + local function spoil_handle(i) + i.spoil_ticks = nil + i.spoil_result = nil + i.spoil_to_trigger_result = nil + end + + -- spoil_handle(data.raw['item']['iron-bacteria']) + -- spoil_handle(data.raw['item']['copper-bacteria']) + spoil_handle(data.raw['item']['nutrients']) + spoil_handle(data.raw['item']['captive-biter-spawner']) + spoil_handle(data.raw['item']['biter-egg']) + spoil_handle(data.raw['item']['pentapod-egg']) + spoil_handle(data.raw['capsule']['raw-fish']) + spoil_handle(data.raw['capsule']['yumako-mash']) + spoil_handle(data.raw['capsule']['yumako']) + spoil_handle(data.raw['capsule']['jelly']) + spoil_handle(data.raw['capsule']['jellynut']) + spoil_handle(data.raw['capsule']['bioflux']) + spoil_handle(data.raw['tool']['agricultural-science-pack']) + + data:extend({{ + type = 'recipe', + name = 'spoilage-from-nutrients', + energy_required = 1, + enabled = false, + ingredients = {{type='item', name='nutrients', amount=1}}, + results = {{type='item', name='spoilage', amount=10}}, + main_product = 'spoilage', + localised_name = {'phi-cl.combine', '', ''} + }}) + + table.insert(data.raw.technology['agriculture'].effects, {type='unlock-recipe', recipe='spoilage-from-nutrients'}) + end + + if settings.startup['PHI-CT-SA'].value then + if mods['space-age'] then + data:extend({{ + type = 'recipe', + name = 'cliff-explosives-o', + energy_required = 1, + enabled = false, + ingredients = { + {type='item', name='explosives', amount=10}, + {type='item', name='grenade', amount=1}, + {type='item', name='barrel', amount=1} + }, + results = {{type='item', name='cliff-explosives', amount=1}}, + main_product = 'cliff-explosives', + localised_name = data.raw['recipe']['cliff-explosives'].localised_name + }}) + + table.insert(data.raw.technology['cliff-explosives'].effects, {type='unlock-recipe', recipe='cliff-explosives-o'}) + end + + if mods['elevated-rails'] then + data.raw.technology['elevated-rail'].unit.ingredients = { + {'automation-science-pack', 1}, + {'logistic-science-pack', 1} + } + end end data.raw['utility-constants'].default.rocket_lift_weight = settings.startup['PHI-CT-ROCKET-CAPACITY'].value * 100000 @@ -655,6 +723,9 @@ for _, v in pairs(items['item']) do end main.EL(v) + + else + items['handle'][v.stage]['item'] = true end end @@ -668,5 +739,8 @@ for _, v in pairs(items['equipment']) do main.ER(v, j) main.ET(v, j) end + + else + items['handle'][v.stage]['equipment'] = true end end