diff --git a/PHI-EN/data-updates.lua b/PHI-EN/data-updates.lua index d8edb53..bb1760f 100644 --- a/PHI-EN/data-updates.lua +++ b/PHI-EN/data-updates.lua @@ -2,11 +2,13 @@ local items = require 'config' for k, v in pairs(items['setting']) do for k2=1, #v.effect do - if settings.startup[k].value < items[v.effect[k2]].min then - items[v.effect[k2]].enabled = false - end + if items[v.effect[k2]] ~= nil then + if settings.startup[k].value < items[v.effect[k2]].min then + items[v.effect[k2]].enabled = false + end - items[v.effect[k2]][v.type] = settings.startup[k].value + items[v.effect[k2]][v.type] = settings.startup[k].value + end end end diff --git a/PHI-EN/data.lua b/PHI-EN/data.lua index 8243ab1..37d71ac 100644 --- a/PHI-EN/data.lua +++ b/PHI-EN/data.lua @@ -165,14 +165,15 @@ local function ET(source, tier) end end - for k, v in pairs(items['setting']) do for k2=1, #v.effect do - if settings.startup[k].value < items[v.effect[k2]].min then - items[v.effect[k2]].enabled = false - end + if items[v.effect[k2]] ~= nil then + if settings.startup[k].value < items[v.effect[k2]].min then + items[v.effect[k2]].enabled = false + end - items[v.effect[k2]][v.type] = settings.startup[k].value + items[v.effect[k2]][v.type] = settings.startup[k].value + end end end diff --git a/PHI-EN/info.json b/PHI-EN/info.json index 53d2528..fa44c9f 100644 --- a/PHI-EN/info.json +++ b/PHI-EN/info.json @@ -1,6 +1,6 @@ { "name": "PHI-EN", - "version": "1.3.5", + "version": "1.3.6", "factorio_version": "1.1", "date": "2023-09-19", "title": "Phidias Energy", diff --git a/PHI-EQ/data.lua b/PHI-EQ/data.lua index 8e65157..27eaced 100644 --- a/PHI-EQ/data.lua +++ b/PHI-EQ/data.lua @@ -178,11 +178,13 @@ end for k, v in pairs(items['setting']) do for k2=1, #v.effect do - if settings.startup[k].value < items[v.effect[k2]].min then - items[v.effect[k2]].enabled = false - end + if items[v.effect[k2]] ~= nil then + if settings.startup[k].value < items[v.effect[k2]].min then + items[v.effect[k2]].enabled = false + end - items[v.effect[k2]][v.type] = settings.startup[k].value + items[v.effect[k2]][v.type] = settings.startup[k].value + end end end diff --git a/PHI-EQ/info.json b/PHI-EQ/info.json index c29ced6..0e15258 100644 --- a/PHI-EQ/info.json +++ b/PHI-EQ/info.json @@ -1,6 +1,6 @@ { "name": "PHI-EQ", - "version": "1.2.1", + "version": "1.2.2", "factorio_version": "1.1", "date": "2023-09-19", "title": "Phidias Equipment", diff --git a/PHI-MB/config.lua b/PHI-MB/config.lua index d09d3e6..4f1e729 100644 --- a/PHI-MB/config.lua +++ b/PHI-MB/config.lua @@ -1,4 +1,34 @@ local items = { + ['setting'] = { + ['PHI-MB-ASSEMBLING-TIER'] = { + type = 'max', + effect = {'assembling-machine'} + }, + ['PHI-MB-FURNACE-TIER'] = { + type = 'max', + effect = {'electric-furnace', 'electric-filter-furnace', 'industrial-furnace'} + }, + ['PHI-MB-OIL-TIER'] = { + type = 'max', + effect = {'oil-refinery', 'chemical-plant', 'fuel-processor', 'se-fuel-refinery'} + }, + ['PHI-MB-CENTRIFUGE-TIER'] = { + type = 'max', + effect = {'centrifuge'} + }, + ['PHI-MB-LAB-TIER'] = { + type = 'max', + effect = {'lab'} + }, + ['PHI-MB-MINING-TIER'] = { + type = 'max', + effect = {'electric-mining-drill', 'pumpjack', 'area-mining-drill'} + }, + ['PHI-MB-SE-ASSEMBLING-TIER'] = { + type = 'max', + effect = {'se-space-assembling-machine', 'se-space-manufactory', 'se-casting-machine', 'se-pulveriser', 'se-lifesupport-facility'} + } + }, ['assembling-machine'] = { enabled = true, stage = 1, diff --git a/PHI-MB/data-updates.lua b/PHI-MB/data-updates.lua index ac61536..e2951a4 100644 --- a/PHI-MB/data-updates.lua +++ b/PHI-MB/data-updates.lua @@ -1,5 +1,18 @@ local items = require 'config' +for k, v in pairs(items['setting']) do + for k2=1, #v.effect do + if items[v.effect[k2]] ~= nil then + if settings.startup[k].value < items[v.effect[k2]].min then + items[v.effect[k2]].enabled = false + end + + items[v.effect[k2]][v.type] = settings.startup[k].value + end + end +end + + -- entity local function EE(source, tier) local item = table.deepcopy(data.raw[source.type][source.ref_name]) @@ -82,6 +95,25 @@ for _, v in pairs(items) do end end +for k, v in pairs(items) do + if k ~= 'setting' then + if v.enabled then + data.raw[v.type][v.ref_name].fast_replaceable_group = v.type + + if v.max > 2 then + data.raw[v.type][v.name .. '-' .. 2].fast_replaceable_group = data.raw[v.type][v.ref_name].fast_replaceable_group + end + + if v.max > v.min then + for j=v.min + 1, v.max do + data.raw[v.type][v.name .. '-' .. j].fast_replaceable_group = data.raw[v.type][v.name .. '-' .. (j - 1)].fast_replaceable_group + end + end + end + end +end + +--[[ -- assembling machine data.raw['assembling-machine']['assembling-machine-4'].fast_replaceable_group = data.raw['assembling-machine']['assembling-machine-3'].fast_replaceable_group data.raw['assembling-machine']['assembling-machine-5'].fast_replaceable_group = data.raw['assembling-machine']['assembling-machine-4'].fast_replaceable_group @@ -184,3 +216,4 @@ if mods['space-exploration'] then data.raw['assembling-machine']['se-fuel-refinery-2'].fast_replaceable_group = data.raw['assembling-machine']['se-fuel-refinery'].fast_replaceable_group data.raw['assembling-machine']['se-fuel-refinery-3'].fast_replaceable_group = data.raw['assembling-machine']['se-fuel-refinery-2'].fast_replaceable_group end +]] \ No newline at end of file diff --git a/PHI-MB/data.lua b/PHI-MB/data.lua index a25e179..3750264 100644 --- a/PHI-MB/data.lua +++ b/PHI-MB/data.lua @@ -85,14 +85,28 @@ local function ET(source, tier) table.insert(data.raw.technology[source.tech].effects, {type='unlock-recipe', recipe=source.name .. '-' .. tier}) end -for _, v in pairs(items) do - if v.enabled then - if v.stage == 1 then - for j=v.min, v.max, 1 do - EE(v, j) - EI(v, j) - ER(v, j) - ET(v, j) +for k, v in pairs(items['setting']) do + for k2=1, #v.effect do + if items[v.effect[k2]] ~= nil then + if settings.startup[k].value < items[v.effect[k2]].min then + items[v.effect[k2]].enabled = false + end + + items[v.effect[k2]][v.type] = settings.startup[k].value + end + end +end + +for k, v in pairs(items) do + if k ~= 'setting' then + if v.enabled then + if v.stage == 1 then + for j=v.min, v.max, 1 do + EE(v, j) + EI(v, j) + ER(v, j) + ET(v, j) + end end end end diff --git a/PHI-MB/info.json b/PHI-MB/info.json index ff69901..b60df86 100644 --- a/PHI-MB/info.json +++ b/PHI-MB/info.json @@ -1,8 +1,8 @@ { "name": "PHI-MB", - "version": "1.0.15", + "version": "1.1.0", "factorio_version": "1.1", - "date": "2023-05-09", + "date": "2023-09-19", "title": "Phidias Megabase", "author": "PHIDIAS0303", "contributers": "", diff --git a/PHI-MB/locale/en/locale.cfg b/PHI-MB/locale/en/locale.cfg index 9fd90df..56e8b1a 100644 --- a/PHI-MB/locale/en/locale.cfg +++ b/PHI-MB/locale/en/locale.cfg @@ -111,3 +111,12 @@ se-lifesupport-facility-2=Sustaining life in more hostile environments. se-lifesupport-facility-3=Sustaining life in more hostile environments. se-fuel-refinery-2=An automated fuel processing structure. se-fuel-refinery-3=An automated fuel processing structure. + +[mod-setting-name] +PHI-MB-ASSEMBLING-TIER=Assembling machine +PHI-MB-FURNACE-TIER=Electric furnace +PHI-MB-OIL-TIER=Oil refinery +PHI-MB-CENTRIFUGE-TIER=Centrifuge +PHI-MB-LAB-TIER=Lab +PHI-MB-MINING-TIER=Electric mining drill +PHI-MB-SE-ASSEMBLING-TIER=Space assembling machine diff --git a/PHI-MB/locale/ja/locale.cfg b/PHI-MB/locale/ja/locale.cfg index ebe5da4..27bd01d 100644 --- a/PHI-MB/locale/ja/locale.cfg +++ b/PHI-MB/locale/ja/locale.cfg @@ -110,4 +110,13 @@ se-pulveriser-3=り硬い鉱物やコア断片などを粉砕・破砕するこ se-lifesupport-facility-2=過酷な環境での生存を支えます。 se-lifesupport-facility-3=過酷な環境での生存を支えます。 se-fuel-refinery-2=燃料を自動で製作します。 -se-fuel-refinery-3=燃料を自動で製作します。 \ No newline at end of file +se-fuel-refinery-3=燃料を自動で製作します。 + +[mod-setting-name] +PHI-MB-ASSEMBLING-TIER=組立機 +PHI-MB-FURNACE-TIER=電気炉 +PHI-MB-OIL-TIER=原油精製所 +PHI-MB-CENTRIFUGE-TIER=遠心分離機 +PHI-MB-LAB-TIER=研究所 +PHI-MB-MINING-TIER=電動掘削機 +PHI-MB-SE-ASSEMBLING-TIER=宇宙組立機 diff --git a/PHI-MB/locale/zh-CN/locale.cfg b/PHI-MB/locale/zh-CN/locale.cfg index bf9cf9b..2c08991 100644 --- a/PHI-MB/locale/zh-CN/locale.cfg +++ b/PHI-MB/locale/zh-CN/locale.cfg @@ -111,3 +111,12 @@ se-lifesupport-facility-2=在更加惡劣的環境中支持生命。 se-lifesupport-facility-3=在更加惡劣的環境中支持生命。 se-fuel-refinery-2=一種自動的原油精煉建築物。 se-fuel-refinery-3=一種自動的原油精煉建築物。 + +[mod-setting-name] +PHI-MB-ASSEMBLING-TIER=組裝機 +PHI-MB-FURNACE-TIER=電爐 +PHI-MB-OIL-TIER=煉油廠 +PHI-MB-CENTRIFUGE-TIER=離心機 +PHI-MB-LAB-TIER=實驗室 +PHI-MB-MINING-TIER=電能採礦機 +PHI-MB-SE-ASSEMBLING-TIER=太空組裝機 diff --git a/PHI-MB/locale/zh-TW/locale.cfg b/PHI-MB/locale/zh-TW/locale.cfg index bf9cf9b..2c08991 100644 --- a/PHI-MB/locale/zh-TW/locale.cfg +++ b/PHI-MB/locale/zh-TW/locale.cfg @@ -111,3 +111,12 @@ se-lifesupport-facility-2=在更加惡劣的環境中支持生命。 se-lifesupport-facility-3=在更加惡劣的環境中支持生命。 se-fuel-refinery-2=一種自動的原油精煉建築物。 se-fuel-refinery-3=一種自動的原油精煉建築物。 + +[mod-setting-name] +PHI-MB-ASSEMBLING-TIER=組裝機 +PHI-MB-FURNACE-TIER=電爐 +PHI-MB-OIL-TIER=煉油廠 +PHI-MB-CENTRIFUGE-TIER=離心機 +PHI-MB-LAB-TIER=實驗室 +PHI-MB-MINING-TIER=電能採礦機 +PHI-MB-SE-ASSEMBLING-TIER=太空組裝機 diff --git a/PHI-MB/migrations/migrations.lua b/PHI-MB/migrations/migrations.lua index 0b8f2fb..abc5821 100644 --- a/PHI-MB/migrations/migrations.lua +++ b/PHI-MB/migrations/migrations.lua @@ -4,13 +4,15 @@ for _, force in pairs(game.forces) do local technologies = force.technologies local recipes = force.recipes - for _, v in pairs(items) do - if v.enabled then - if technologies[v.tech] ~= nil then - if technologies[v.tech].researched then - for j=v.min, v.max, 1 do - recipes[v.name .. '-' .. j].enabled = true - recipes[v.name .. '-' .. j].reload() + for k, v in pairs(items) do + if k ~= 'setting' then + if v.enabled then + if technologies[v.tech] ~= nil then + if technologies[v.tech].researched then + for j=v.min, v.max, 1 do + recipes[v.name .. '-' .. j].enabled = true + recipes[v.name .. '-' .. j].reload() + end end end end diff --git a/PHI-MB/settings.lua b/PHI-MB/settings.lua new file mode 100644 index 0000000..6e3d4a1 --- /dev/null +++ b/PHI-MB/settings.lua @@ -0,0 +1,50 @@ +data:extend({{ + type = 'int-setting', + name = 'PHI-MB-ASSEMBLING-TIER', + setting_type = 'startup', + default_value = 5, + allowed_values = {3, 4, 5}, + order = 'A1' + }, { + type = 'int-setting', + name = 'PHI-MB-FURNACE-TIER', + setting_type = 'startup', + default_value = 3, + allowed_values = {1, 2, 3}, + order = 'A2' + }, { + type = 'int-setting', + name = 'PHI-MB-OIL-TIER', + setting_type = 'startup', + default_value = 3, + allowed_values = {1, 2, 3}, + order = 'A3' + }, { + type = 'int-setting', + name = 'PHI-MB-CENTRIFUGE-TIER', + setting_type = 'startup', + default_value = 3, + allowed_values = {1, 2, 3}, + order = 'A4' + }, { + type = 'int-setting', + name = 'PHI-MB-LAB-TIER', + setting_type = 'startup', + default_value = 3, + allowed_values = {1, 2, 3}, + order = 'A5' + }, { + type = 'int-setting', + name = 'PHI-MB-MINING-TIER', + setting_type = 'startup', + default_value = 3, + allowed_values = {1, 2, 3}, + order = 'A6' + }, { + type = 'int-setting', + name = 'PHI-MB-SE-ASSEMBLING-TIER', + setting_type = 'startup', + default_value = 3, + allowed_values = {1, 2, 3}, + order = 'A7' + }}) \ No newline at end of file