This commit is contained in:
2023-09-18 02:22:54 +09:00
parent e03b8955a0
commit 4b44472e74
4 changed files with 103 additions and 66 deletions

View File

@@ -1,4 +1,30 @@
local items = {
['setting'] = {
['PHI-EN-SOLAR'] = {
type = 'enabled',
effect = {'solar-panel', 'accumulator'}
},
['PHI-EN-STEAM'] = {
type = 'enabled',
effect = {'boiler', 'steam-engine'}
},
['PHI-EN-NUCLEAR'] = {
type = 'enabled',
effect = {'nuclear-reactor', 'heat-pipe', 'heat-exchanger', 'steam-turbine'}
},
['PHI-EN-SOLAR-TIER'] = {
type = 'max',
effect = {'solar-panel', 'accumulator'}
},
['PHI-EN-STEAM-TIER'] = {
type = 'max',
effect = {'boiler', 'steam-engine'}
},
['PHI-EN-NUCLEAR-TIER'] = {
type = 'max',
effect = {'nuclear-reactor', 'heat-pipe', 'heat-exchanger', 'steam-turbine'}
}
},
['solar-panel'] = {
enabled = true,
type = 'solar-panel',

View File

@@ -1,63 +1,25 @@
-- accumulator
data.raw['accumulator']['accumulator'].fast_replaceable_group = 'accumulator'
data.raw['accumulator']['accumulator-2'].fast_replaceable_group = data.raw['accumulator']['accumulator'].fast_replaceable_group
data.raw['accumulator']['accumulator-3'].fast_replaceable_group = data.raw['accumulator']['accumulator-2'].fast_replaceable_group
data.raw['accumulator']['accumulator-4'].fast_replaceable_group = data.raw['accumulator']['accumulator-3'].fast_replaceable_group
data.raw['accumulator']['accumulator-5'].fast_replaceable_group = data.raw['accumulator']['accumulator-4'].fast_replaceable_group
data.raw['accumulator']['accumulator-6'].fast_replaceable_group = data.raw['accumulator']['accumulator-5'].fast_replaceable_group
data.raw['accumulator']['accumulator-7'].fast_replaceable_group = data.raw['accumulator']['accumulator-6'].fast_replaceable_group
data.raw['accumulator']['accumulator-8'].fast_replaceable_group = data.raw['accumulator']['accumulator-7'].fast_replaceable_group
local items = require 'config'
-- solar-panel
data.raw['solar-panel']['solar-panel'].fast_replaceable_group = 'solar-panel'
data.raw['solar-panel']['solar-panel-2'].fast_replaceable_group = data.raw['solar-panel']['solar-panel'].fast_replaceable_group
data.raw['solar-panel']['solar-panel-3'].fast_replaceable_group = data.raw['solar-panel']['solar-panel-2'].fast_replaceable_group
data.raw['solar-panel']['solar-panel-4'].fast_replaceable_group = data.raw['solar-panel']['solar-panel-3'].fast_replaceable_group
data.raw['solar-panel']['solar-panel-5'].fast_replaceable_group = data.raw['solar-panel']['solar-panel-4'].fast_replaceable_group
data.raw['solar-panel']['solar-panel-6'].fast_replaceable_group = data.raw['solar-panel']['solar-panel-5'].fast_replaceable_group
data.raw['solar-panel']['solar-panel-7'].fast_replaceable_group = data.raw['solar-panel']['solar-panel-6'].fast_replaceable_group
data.raw['solar-panel']['solar-panel-8'].fast_replaceable_group = data.raw['solar-panel']['solar-panel-7'].fast_replaceable_group
for k, v in pairs(items['setting']) do
for k2=1, #v.effect do
items[v.effect[k2]][v.type] = settings.startup[k].value
end
end
-- boiler
data.raw['boiler']['boiler'].fast_replaceable_group = 'boiler'
data.raw['boiler']['boiler-2'].fast_replaceable_group = data.raw['boiler']['boiler'].fast_replaceable_group
data.raw['boiler']['boiler-3'].fast_replaceable_group = data.raw['boiler']['boiler-2'].fast_replaceable_group
data.raw['boiler']['boiler-4'].fast_replaceable_group = data.raw['boiler']['boiler-3'].fast_replaceable_group
data.raw['boiler']['boiler-5'].fast_replaceable_group = data.raw['boiler']['boiler-4'].fast_replaceable_group
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
-- steam-engine
data.raw['generator']['steam-engine'].fast_replaceable_group = 'steam-engine'
data.raw['generator']['steam-engine-2'].fast_replaceable_group = data.raw['generator']['steam-engine'].fast_replaceable_group
data.raw['generator']['steam-engine-3'].fast_replaceable_group = data.raw['generator']['steam-engine-2'].fast_replaceable_group
data.raw['generator']['steam-engine-4'].fast_replaceable_group = data.raw['generator']['steam-engine-3'].fast_replaceable_group
data.raw['generator']['steam-engine-5'].fast_replaceable_group = data.raw['generator']['steam-engine-4'].fast_replaceable_group
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
-- nuclear-reactor
data.raw['reactor']['nuclear-reactor'].fast_replaceable_group = 'reactor'
data.raw['reactor']['nuclear-reactor-2'].fast_replaceable_group = data.raw['reactor']['nuclear-reactor'].fast_replaceable_group
data.raw['reactor']['nuclear-reactor-3'].fast_replaceable_group = data.raw['reactor']['nuclear-reactor-2'].fast_replaceable_group
data.raw['reactor']['nuclear-reactor-4'].fast_replaceable_group = data.raw['reactor']['nuclear-reactor-3'].fast_replaceable_group
data.raw['reactor']['nuclear-reactor-5'].fast_replaceable_group = data.raw['reactor']['nuclear-reactor-4'].fast_replaceable_group
-- heat-pipe
data.raw['heat-pipe']['heat-pipe'].fast_replaceable_group = 'heat-pipe'
data.raw['heat-pipe']['heat-pipe-2'].fast_replaceable_group = data.raw['heat-pipe']['heat-pipe'].fast_replaceable_group
data.raw['heat-pipe']['heat-pipe-3'].fast_replaceable_group = data.raw['heat-pipe']['heat-pipe-2'].fast_replaceable_group
data.raw['heat-pipe']['heat-pipe-4'].fast_replaceable_group = data.raw['heat-pipe']['heat-pipe-3'].fast_replaceable_group
data.raw['heat-pipe']['heat-pipe-5'].fast_replaceable_group = data.raw['heat-pipe']['heat-pipe-4'].fast_replaceable_group
-- heat-exchanger
data.raw['boiler']['heat-exchanger'].fast_replaceable_group = 'heat-exchanger'
data.raw['boiler']['heat-exchanger-2'].fast_replaceable_group = data.raw['boiler']['heat-exchanger'].fast_replaceable_group
data.raw['boiler']['heat-exchanger-3'].fast_replaceable_group = data.raw['boiler']['heat-exchanger-2'].fast_replaceable_group
data.raw['boiler']['heat-exchanger-4'].fast_replaceable_group = data.raw['boiler']['heat-exchanger-3'].fast_replaceable_group
data.raw['boiler']['heat-exchanger-5'].fast_replaceable_group = data.raw['boiler']['heat-exchanger-4'].fast_replaceable_group
-- steam-turbine
data.raw['generator']['steam-turbine'].fast_replaceable_group = 'steam-engine'
data.raw['generator']['steam-turbine-2'].fast_replaceable_group = data.raw['generator']['steam-turbine'].fast_replaceable_group
data.raw['generator']['steam-turbine-3'].fast_replaceable_group = data.raw['generator']['steam-turbine-2'].fast_replaceable_group
data.raw['generator']['steam-turbine-4'].fast_replaceable_group = data.raw['generator']['steam-turbine-3'].fast_replaceable_group
data.raw['generator']['steam-turbine-5'].fast_replaceable_group = data.raw['generator']['steam-turbine-4'].fast_replaceable_group
data.raw['fluid']['steam'].max_temperature = 5000
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

View File

@@ -165,13 +165,22 @@ local function ET(source, tier)
end
end
for _, v in pairs(items) do
if v.enabled 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
items[v.effect[k2]][v.type] = settings.startup[k].value
end
end
for k, v in pairs(items) do
if k ~= 'setting' then
if v.enabled 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

40
PHI-EN/settings.lua Normal file
View File

@@ -0,0 +1,40 @@
data:extend({{
type = 'bool-setting',
name = 'PHI-EN-SOLAR',
setting_type = 'startup',
default_value = true,
order = 'A1'
}, {
type = 'bool-setting',
name = 'PHI-EN-STEAM',
setting_type = 'startup',
default_value = true,
order = 'A2'
}, {
type = 'bool-setting',
name = 'PHI-EN-NUCLEAR',
setting_type = 'startup',
default_value = true,
order = 'A3'
}, {
type = 'int-setting',
name = 'PHI-EN-SOLAR-TIER',
setting_type = 'startup',
default_value = 8,
allowed_values = {2, 3, 4, 5, 6, 7, 8},
order = 'B1'
}, {
type = 'int-setting',
name = 'PHI-EN-STEAM-TIER',
setting_type = 'startup',
default_value = 5,
allowed_values = {2, 3, 4, 5},
order = 'B2'
}, {
type = 'int-setting',
name = 'PHI-EN-NUCLEAR-TIER',
setting_type = 'startup',
default_value = 5,
allowed_values = {2, 3, 4, 5},
order = 'B3'
}})