This commit is contained in:
2026-06-19 19:15:37 +09:00
parent c169418db9
commit 85b8effc3d
+55 -70
View File
@@ -82,63 +82,61 @@ function main_entity(source, tier)
end
end
if source.tech == 'compound-energy' then
if mods['space-age'] and (not (settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value == 'VP')) then
if not item.surface_conditions then
item.surface_conditions = {}
end
table.insert(item.surface_conditions, {property = 'gravity', min = 0.01})
if mods['space-age'] and (not (settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value == 'VP')) then
if not item.surface_conditions then
item.surface_conditions = {}
end
if (source.type == 'accumulator') and item['chargable_graphics'] then
if item['chargable_graphics']['picture'].layers and item['chargable_graphics']['picture'].layers[1] then
item['chargable_graphics']['picture'].layers[1].tint = mod_tint[tier]
end
table.insert(item.surface_conditions, {property = 'gravity', min = 0.01})
end
for _, v in pairs({item['chargable_graphics']['charge_animation'], item['chargable_graphics']['discharge_animation']}) do
if v.layers and v.layers[1] and v.layers[1].layers and v.layers[1].layers[1] then
v.layers[1].layers[1].tint = mod_tint[tier]
end
end
for _, v in pairs({'buffer_capacity', 'input_flow_limit', 'output_flow_limit'}) do
item.energy_source[v] = (item.energy_source[v] and (tonumber(string.match(item.energy_source[v], '[%d%.]+')) * (settings.startup['PHI-MB-ENERGY-SOLAR-RATIO'].value ^ (tier - source.min + 1)) .. string.match(item.energy_source[v], '%a+'))) or nil
end
elseif (source.type == 'boiler') then
item.energy_consumption = tostring(tonumber(string.match(item.energy_consumption, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.energy_consumption, '%a+')
item.target_temperature = 15 + ((item.target_temperature - 15) * (2 * (tier - source.min + 1)))
if (source.name == 'heat-exchanger') then
item.energy_source.min_working_temperature = 15 + ((item.energy_source.min_working_temperature - 15) * (2 * (tier - source.min + 1)))
item.energy_source.max_temperature = item.energy_source.max_temperature * (2 * (tier - source.min + 1))
item.energy_source.max_transfer = tostring(tonumber(string.match(item.energy_source.max_transfer, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.energy_source.max_transfer, '%a+')
end
elseif (source.type == 'generator') then
item.max_power_output = (item.max_power_output and (tonumber(string.match(item.max_power_output, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.max_power_output, '%a+')) or nil
item.maximum_temperature = (item.maximum_temperature and 15 + ((item.maximum_temperature - 15) * (2 * (tier - source.min + 1)))) or nil
elseif (source.type == 'reactor') then
item.consumption = tostring(tonumber(string.match(item.consumption, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.consumption, '%a+')
item.heat_buffer.max_temperature = item.heat_buffer.max_temperature * (2 * (tier - source.min + 1))
item.heat_buffer.max_transfer = tostring(tonumber(string.match(item.heat_buffer.max_transfer, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.heat_buffer.max_transfer, '%a+')
tint_handle(item, tier, {'connection_patches_connected', 'connection_patches_disconnected', 'heat_connection_patches_connected', 'heat_connection_patches_disconnected', 'lower_layer_picture'})
elseif (source.type == 'fusion-reactor') then
item.power_input = tostring(tonumber(string.match(item.power_input, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.power_input, '%a+')
item.max_fluid_usage = item.max_fluid_usage * (2 * (tier - source.min + 1))
elseif (source.type == 'fusion-generator') then
item.energy_source.output_flow_limit = tostring(tonumber(string.match(item.energy_source.output_flow_limit, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.energy_source.output_flow_limit, '%a+')
item.max_fluid_usage = item.max_fluid_usage * (2 * (tier - source.min + 1))
elseif (source.type == 'heat-pipe') then
item.heat_buffer.max_temperature = item.heat_buffer.max_temperature * (2 * (tier - source.min + 1))
item.heat_buffer.max_transfer = tostring(tonumber(string.match(item.heat_buffer.max_transfer, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.heat_buffer.max_transfer, '%a+')
tint_handle(item, tier, {'connection_sprites', 'heat_glow_sprites'})
if (source.type == 'accumulator') and item['chargable_graphics'] then
if item['chargable_graphics']['picture'].layers and item['chargable_graphics']['picture'].layers[1] then
item['chargable_graphics']['picture'].layers[1].tint = mod_tint[tier]
end
for _, v in pairs({item['chargable_graphics']['charge_animation'], item['chargable_graphics']['discharge_animation']}) do
if v.layers and v.layers[1] and v.layers[1].layers and v.layers[1].layers[1] then
v.layers[1].layers[1].tint = mod_tint[tier]
end
end
for _, v in pairs({'buffer_capacity', 'input_flow_limit', 'output_flow_limit'}) do
item.energy_source[v] = (item.energy_source[v] and (tonumber(string.match(item.energy_source[v], '[%d%.]+')) * (settings.startup['PHI-MB-ENERGY-SOLAR-RATIO'].value ^ (tier - source.min + 1)) .. string.match(item.energy_source[v], '%a+'))) or nil
end
elseif (source.type == 'boiler') then
item.energy_consumption = tostring(tonumber(string.match(item.energy_consumption, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.energy_consumption, '%a+')
item.target_temperature = 15 + ((item.target_temperature - 15) * (2 * (tier - source.min + 1)))
if (source.name == 'heat-exchanger') then
item.energy_source.min_working_temperature = 15 + ((item.energy_source.min_working_temperature - 15) * (2 * (tier - source.min + 1)))
item.energy_source.max_temperature = item.energy_source.max_temperature * (2 * (tier - source.min + 1))
item.energy_source.max_transfer = tostring(tonumber(string.match(item.energy_source.max_transfer, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.energy_source.max_transfer, '%a+')
end
elseif (source.type == 'generator') then
item.max_power_output = (item.max_power_output and (tonumber(string.match(item.max_power_output, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.max_power_output, '%a+')) or nil
item.maximum_temperature = (item.maximum_temperature and 15 + ((item.maximum_temperature - 15) * (2 * (tier - source.min + 1)))) or nil
elseif (source.type == 'reactor') then
item.consumption = tostring(tonumber(string.match(item.consumption, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.consumption, '%a+')
item.heat_buffer.max_temperature = item.heat_buffer.max_temperature * (2 * (tier - source.min + 1))
item.heat_buffer.max_transfer = tostring(tonumber(string.match(item.heat_buffer.max_transfer, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.heat_buffer.max_transfer, '%a+')
tint_handle(item, tier, {'connection_patches_connected', 'connection_patches_disconnected', 'heat_connection_patches_connected', 'heat_connection_patches_disconnected', 'lower_layer_picture'})
elseif (source.type == 'fusion-reactor') then
item.power_input = tostring(tonumber(string.match(item.power_input, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.power_input, '%a+')
item.max_fluid_usage = item.max_fluid_usage * (2 * (tier - source.min + 1))
elseif (source.type == 'fusion-generator') then
item.energy_source.output_flow_limit = tostring(tonumber(string.match(item.energy_source.output_flow_limit, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.energy_source.output_flow_limit, '%a+')
item.max_fluid_usage = item.max_fluid_usage * (2 * (tier - source.min + 1))
elseif (source.type == 'heat-pipe') then
item.heat_buffer.max_temperature = item.heat_buffer.max_temperature * (2 * (tier - source.min + 1))
item.heat_buffer.max_transfer = tostring(tonumber(string.match(item.heat_buffer.max_transfer, '[%d%.]+')) * (2 * (tier - source.min + 1))) .. string.match(item.heat_buffer.max_transfer, '%a+')
tint_handle(item, tier, {'connection_sprites', 'heat_glow_sprites'})
end
tint_handle(item, tier, {'picture', 'pictures', 'animation', 'structure', 'integration_patch', 'horizontal_animation', 'vertical_animation'})
@@ -188,13 +186,8 @@ function main_item(source, tier)
item.icons[1].tint = mod_tint[tier]
elseif item.icon then
item.icons = {{icon = item.icon, tint = mod_tint[tier]}}
item.icons = {{icon = item.icon, icon_size = (item.icon_size and item.icon_size) or nil, tint = mod_tint[tier]}}
item.icon = nil
if item.icon_size then
item.icons[1].icon_size = item.icon_size
item.icon_size = nil
end
end
table.insert(item.icons, {icon = '__base__/graphics/icons/signal/signal_' .. tier .. '.png', icon_size = 64, scale = 0.25, shift = {12, 12}})
@@ -206,16 +199,7 @@ function main_item(source, tier)
end
function main_recipe(source, tier)
local result_name = source.name .. ((source.category == 'equipment' and ('-mk' .. tier .. '-equipment')) or ('-' .. tier))
local ingredients = {}
local ingredient_name = (tier > source.min and (source.name .. '-' .. (tier - 1))) or source.ref_name
if source.tech == 'compound-energy' and (source.type == 'solar-panel' or source.type == 'accumulator') then
table.insert(ingredients, {type = 'item', name = ingredient_name, amount = tonumber(settings.startup['PHI-MB-ENERGY-SOLAR-RATIO'].value) or 4})
else
table.insert(ingredients, {type = 'item', name = ingredient_name, amount = 2})
end
local result_name = source.name .. '-' .. tier
data:extend({{
type = 'recipe',
@@ -223,7 +207,7 @@ function main_recipe(source, tier)
icons = table.deepcopy(data.raw.item[source.ref_name].icons),
energy_required = 2,
enabled = false,
ingredients = ingredients,
ingredients = {{type = 'item', name = (tier > source.min and (source.name .. '-' .. (tier - 1))) or source.ref_name, amount = ((source.tech == 'compound-energy' and (source.type == 'solar-panel' or source.type == 'accumulator')) and tonumber(settings.startup['PHI-MB-ENERGY-SOLAR-RATIO'].value) or 4) or 2}},
results = {{type = 'item', name = result_name, amount = 1}},
main_product = result_name,
localised_name = {'?', data.raw[source.type][result_name].localised_name, ''},
@@ -265,6 +249,7 @@ for _, v in pairs(items) do
main_entity(v, j)
main_item(v, j)
main_recipe(v, j)
table.insert(data.raw.technology['compound-energy-' .. (j - 1)].effects, {type='unlock-recipe', recipe=v.name .. '-' .. j})
end