This commit is contained in:
2026-06-19 21:08:23 +09:00
parent 06dc4b5ff1
commit 6c499375d1
3 changed files with 64 additions and 150 deletions
+64 -81
View File
@@ -32,56 +32,8 @@ for i = 1, 7 do
}})
end
local function tint_handle(item, tier, tl)
for _, ve in pairs(tl) do
if item[ve] then
for _, tc in pairs({'layers', 'sheets', 'structure', 'frames'}) do
if item[ve][tc] and type(item[ve][tc]) == 'table' then
for _, v2 in pairs(item[ve][tc]) do
v2.tint = mod_tint[tier]
if v2.frames then
for _, v3 in pairs(v2.frames) do
v3.tint = mod_tint[tier]
end
end
end
end
end
item[ve].tint = mod_tint[tier]
end
end
end
function tint_layer(al, t)
for _, l in pairs(al) do
if not l.draw_as_shadow then
l.tint = mod_tint[t]
end
end
end
function tint(i, p, t)
if not i then
return
end
if p then
for _, c in pairs(p) do
if i[c] and i[c].layers then
tint_layer(i[c].layers, t)
end
if c == 'picture' then
table.insert(i[c].layers, {icon = '__base__/graphics/icons/signal/signal_' .. t .. '.png', icon_size = 64, scale = 0.25, shift = {12, 12}})
end
end
else
tint_layer(i.layers, t)
table.insert(i.layers, {icon = '__base__/graphics/icons/signal/signal_' .. t .. '.png', icon_size = 64, scale = 0.25, shift = {12, 12}})
end
function icon_add_number(i, t)
table.insert(i, {icon = '__base__/graphics/icons/signal/signal_' .. t .. '.png', icon_size = 64, scale = 0.25, shift = {12, 12}})
end
function main_entity(source, tier)
@@ -124,26 +76,36 @@ function main_entity(source, tier)
if item['picture'] and item['picture'].layers then
for _, l in pairs(item['picture'].layers) do
if not l.draw_as_shadow then
l.tint = mod_tint[tier]
if not l.draw_as_shadow then
l.tint = mod_tint[tier]
end
end
icon_add_number(item['picture'].layers, tier)
end
end
elseif (source.type == 'accumulator') then
if item['chargable_graphics'] then
tint(item['chargable_graphics'], {'picture', 'charge_animation', 'discharge_animation'}, tier)
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
if item['picture'] then
tint(item['picture'], {'north', 'east', 'south', 'west'}, tier)
if item['chargable_graphics'] then
for _, c in pairs({'picture', 'charge_animation', 'discharge_animation'}) do
if item['chargable_graphics'][c] and item['chargable_graphics'][c].layers then
for _, l in pairs(item['chargable_graphics'][c].layers) do
if not l.draw_as_shadow then
l.tint = mod_tint[tier]
end
end
end
end
if item['chargable_graphics']['picture'] then
icon_add_number(item['chargable_graphics']['picture'].layers, tier)
end
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)))
@@ -153,10 +115,30 @@ function main_entity(source, tier)
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
if item['picture'] then
for _, c in pairs({'north', 'east', 'south', 'west'}) do
if item['picture'][c] and item['picture'][c].structure and item['picture'][c].structure.layers then
for _, l in pairs(item['picture'][c].structure.layers) do
if not l.draw_as_shadow then
l.tint = mod_tint[tier]
end
end
icon_add_number(item['picture'][c].structure.layers, tier)
end
end
end
elseif (source.type == 'generator') then
for _, c in pairs({'horizontal_animation', 'vertical_animation'}) do
if item[c] then
tint(item[c], nil, tier)
if item[c] and item[c].layers then
for _, l in pairs(item[c].layers) do
if not l.draw_as_shadow then
l.tint = mod_tint[tier]
end
end
icon_add_number(item[c].layers, tier)
end
end
@@ -167,7 +149,17 @@ function main_entity(source, tier)
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'})
if item['picture'] and item['picture'].layers then
for _, l in pairs(item['picture'].layers) do
if not l.draw_as_shadow then
l.tint = mod_tint[tier]
end
end
icon_add_number(item['picture'].layers, tier)
end
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+')
@@ -178,9 +170,15 @@ function main_entity(source, tier)
item.max_fluid_usage = item.max_fluid_usage * (2 * (tier - source.min + 1))
elseif (source.type == 'heat-pipe') then
for _, c in pairs({'connection_sprites', 'heat_glow_sprites'}) do
if item[c] then
tint(item[c], {'single', 'straight_vertical', 'straight_horizontal', 'corner_right_up', 'corner_left_up', 'corner_right_down', 'corner_left_down', 't_up', 't_down', 't_right', 't_left', 'cross', 'ending_up', 'ending_down', 'ending_right', 'ending_left'}, tier)
if item['connection_sprites'] then
for _, c in pairs({'single', 'straight_vertical', 'straight_horizontal', 'corner_right_up', 'corner_left_up', 'corner_right_down', 'corner_left_down', 't_up', 't_down', 't_right', 't_left', 'cross', 'ending_up', 'ending_down', 'ending_right', 'ending_left'}) do
if item['connection_sprites'][c] then
for _, l in pairs(item['connection_sprites'][c]) do
l.tint = mod_tint[tier]
end
icon_add_number(item['connection_sprites'][c], tier)
end
end
end
@@ -193,23 +191,8 @@ function main_entity(source, tier)
fusion-reactor
fusion-generator
heating-tower
reactor
tint(item, {'picture'}, tier)
if item['heat_buffer'] then
tint(item['heat_buffer'], {'heat_picture'}, tier)
end
for _, c in pairs({'horizontal_animation', 'vertical_animation'}) do
if item[c] then
tint(item[c], nil, tier)
end
end
]]
item.localised_name = (tier > 1 and {'phi-cl.combine', {'?', {'entity-name.' .. source.ref_name}, {'name.' .. source.ref_name}}, tostring(tier)}) or {'?', {'entity-name.' .. source.ref_name}, {'name.' .. source.ref_name}}
item.localised_description = {'?', {'entity-description.' .. source.ref_name}, {'description.' .. source.ref_name}}
-65
View File
@@ -1,65 +0,0 @@
local mod_tint = {
[2] = {r=140, g=142, b=200},
[3] = {r=242, g=161, b=26},
[4] = {r=255, g=254, b=42},
[5] = {r=54, g=228, b=255},
[6] = {r=253, g=0, b=97},
[7] = {r=0, g=209, b=102},
[8] = {r=233, g=63, b=233}
}
-- MIGS A 1 BASE ENTITY,ITEM,RECIPE
-- MIGS A 9 BASE VIRTUAL_SIGNAL
-- MIGS A 15 SPACE_AGE VIRTUAL_SIGNAL
if data.raw['constant-combinator'] and data.raw['constant-combinator']['constant-combinator'] then
local item = table.deepcopy(data.raw['item']['constant-combinator'])
item.name = 'super-combinator'
item.place_result = item.name
item.order = 'c[combinators]-e[super-combinator]'
item.icons = {{icon = '__base__/graphics/icons/constant-combinator.png', tint = mod_tint[2], icon_size = 64, icon_mipmaps = 4}}
item.icon = nil
item.icon_size = nil
item.icon_mipmaps = nil
item.localised_name = {'', {'name.super-entity'}, {'entity-name.constant-combinator'}}
data:extend({item})
local entity = table.deepcopy(data.raw['constant-combinator']['constant-combinator'])
entity.name = item.name
entity.minable.result = item.name
entity.localised_name = {'', {'name.super-entity'}, {'entity-name.constant-combinator'}}
data:extend({entity})
data:extend({{
type = 'recipe',
name = item.name,
energy_required = 2,
enabled = true,
ingredients = {{type = 'item', name = 'electronic-circuit', amount = 5}, {type = 'item', name = 'copper-cable', amount = 5}},
results = {{type = 'item', name = item.name, amount = 1}},
main_product = item.name,
localised_name = {'', {'name.super-entity'}, {'entity-name.constant-combinator'}}
}})
local s = {}
for _, v in pairs(data.raw['technology']) do
local raw_name = v.name:gsub('-%d+$', '')
if (v.max_level and v.max_level == 'infinite') and v.hidden ~= true then
table.insert(s, {
type = 'virtual-signal',
name = 'signal-' .. v.name,
icons = (v.icons and {v.icons[1]}) or nil,
icon = (v.icon and v.icon) or nil,
icon_size = (v.icon_size and v.icon_size) or nil,
subgroup = 'pictographs',
order = 'z[technology]-[' .. v.name .. ']',
localised_name = {'?', {'technology-name.' .. raw_name}, {'entity-name.' .. raw_name}}
})
end
end
if #s > 0 then
data:extend(s)
end
end