This commit is contained in:
2026-06-19 18:41:12 +09:00
parent be9aea03b1
commit fcce3b4065
3 changed files with 50 additions and 51 deletions
-49
View File
@@ -249,55 +249,6 @@ function main.EEE(source, tier)
data:extend({item}) data:extend({item})
end end
-- equipment
function main.EEQ(source, tier)
local item = table.deepcopy(data.raw[source.type][source.ref_name])
item.name = source.name .. '-mk' .. tier .. '-equipment'
item.take_result = item.name
for _, v in pairs({'power', 'energy_consumption', 'energy_input', 'charging_energy'}) do
item[v] = (item[v] and tostring(tonumber(string.match(item[v], '[%d%.]+')) * (2 ^ (tier - source.min + 1))) .. string.match(item[v], '%a+')) or nil
end
if item.energy_source then
for _, v in pairs({'buffer_capacity', 'input_flow_limit', 'output_flow_limit'}) do
item.energy_source[v] = (item.energy_source[v] and tostring(tonumber(string.match(item.energy_source[v], '[%d%.]+')) * (2 ^ (tier - source.min + 1))) .. string.match(item.energy_source[v], '%a+')) or nil
end
end
for _, v in pairs({'max_shield_value', 'movement_bonus', 'inventory_size_bonus'}) do
item[v] = (item[v] and item[v] * (2 ^ (tier - source.min + 1))) or nil
end
if item.darkness_to_turn_on and item.color_lookup then
item.darkness_to_turn_on = 0
item.color_lookup = {{0, '__core__/graphics/color_luts/lut-sunset.png'}}
end
if item.attack_parameters then
item.attack_parameters.cooldown = (item.attack_parameters.cooldown and item.attack_parameters.cooldown * ((24 - tier + source.min) / 25)) or nil
item.attack_parameters.damage_modifier = (item.attack_parameters.damage_modifier and item.attack_parameters.damage_modifier * (2 ^ (tier - source.min + 1))) or nil
item.attack_parameters.range = (item.attack_parameters.range and item.attack_parameters.range + (tier - source.min + 1)) or nil
if item.attack_parameters.ammo_type then
item.attack_parameters.ammo_type.energy_consumption = (item.attack_parameters.ammo_type.energy_consumption and tostring(tonumber(string.match(item.attack_parameters.ammo_type.energy_consumption, '[%d%.]+')) * (2 ^ (tier - source.min + 1))) .. string.match(item.attack_parameters.ammo_type.energy_consumption, '%a+')) or nil
if item.attack_parameters.ammo_type.action_delivery then
item.attack_parameters.ammo_type.action_delivery.max_length = item.attack_parameters.ammo_type.action_delivery.max_length + (tier - source.min + 1)
end
end
end
if item.sprite then
item.sprite.tint = mod_tint[tier]
end
item.localised_name = (tier > 1 and {'phi-cl.combine', {'?', {'equipment-name.' .. source.ref_name}, {'name.' .. source.ref_name}}, tostring(tier)}) or {'?', {'equipment-name.' .. source.ref_name}, {'name.' .. source.ref_name}}
item.localised_description = {'?', {'equipment-description.' .. source.ref_name}, {'description.' .. source.ref_name}}
data:extend({item})
end
-- item -- item
function main.EI(source, tier) function main.EI(source, tier)
local item = table.deepcopy(data.raw.item[source.ref_name]) local item = table.deepcopy(data.raw.item[source.ref_name])
+1 -1
View File
@@ -26,7 +26,7 @@ for i = 1, 7 do
effects = {}, effects = {},
upgrade = true, upgrade = true,
unit = {count = math.floor(125 * (i ^ 2)), ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, time = 30}, unit = {count = math.floor(125 * (i ^ 2)), ingredients = {{'automation-science-pack', 1}, {'logistic-science-pack', 1}}, time = 30},
icons = {{icon = '__base__/graphics/technology/solar-energy.png', icon_size = 256, tint = mod_tint[i]}}, icons = {{icon = '__base__/graphics/technology/solar-energy.png', icon_size = 256, tint = mod_tint[i]}, {icon = '__base__/graphics/icons/signal/signal_' .. i .. '.png', icon_size = 64, scale = 0.5, shift = {50, 50}}},
order = 'a-h-' .. i, order = 'a-h-' .. i,
localised_name = {'phi-cl.combine', {'technology-name.compound-energy'}, tostring(i)}, localised_name = {'phi-cl.combine', {'technology-name.compound-energy'}, tostring(i)},
localised_description = {'technology-description.compound-energy'} localised_description = {'technology-description.compound-energy'}
+49 -1
View File
@@ -108,6 +108,54 @@ if settings.startup['PHI-MB-EQUIPMENT-ARMOR'].value then
end end
end end
function equipment(source, tier)
local item = table.deepcopy(data.raw[source.type][source.ref_name])
item.name = source.name .. '-mk' .. tier .. '-equipment'
item.take_result = item.name
for _, v in pairs({'power', 'energy_consumption', 'energy_input', 'charging_energy'}) do
item[v] = (item[v] and tostring(tonumber(string.match(item[v], '[%d%.]+')) * (2 ^ (tier - source.min + 1))) .. string.match(item[v], '%a+')) or nil
end
if item.energy_source then
for _, v in pairs({'buffer_capacity', 'input_flow_limit', 'output_flow_limit'}) do
item.energy_source[v] = (item.energy_source[v] and tostring(tonumber(string.match(item.energy_source[v], '[%d%.]+')) * (2 ^ (tier - source.min + 1))) .. string.match(item.energy_source[v], '%a+')) or nil
end
end
for _, v in pairs({'max_shield_value', 'movement_bonus', 'inventory_size_bonus'}) do
item[v] = (item[v] and item[v] * (2 ^ (tier - source.min + 1))) or nil
end
if item.darkness_to_turn_on and item.color_lookup then
item.darkness_to_turn_on = 0
item.color_lookup = {{0, '__core__/graphics/color_luts/lut-sunset.png'}}
end
if item.attack_parameters then
item.attack_parameters.cooldown = (item.attack_parameters.cooldown and item.attack_parameters.cooldown * ((24 - tier + source.min) / 25)) or nil
item.attack_parameters.damage_modifier = (item.attack_parameters.damage_modifier and item.attack_parameters.damage_modifier * (2 ^ (tier - source.min + 1))) or nil
item.attack_parameters.range = (item.attack_parameters.range and item.attack_parameters.range + (tier - source.min + 1)) or nil
if item.attack_parameters.ammo_type then
item.attack_parameters.ammo_type.energy_consumption = (item.attack_parameters.ammo_type.energy_consumption and tostring(tonumber(string.match(item.attack_parameters.ammo_type.energy_consumption, '[%d%.]+')) * (2 ^ (tier - source.min + 1))) .. string.match(item.attack_parameters.ammo_type.energy_consumption, '%a+')) or nil
if item.attack_parameters.ammo_type.action_delivery then
item.attack_parameters.ammo_type.action_delivery.max_length = item.attack_parameters.ammo_type.action_delivery.max_length + (tier - source.min + 1)
end
end
end
if item.sprite then
item.sprite.tint = mod_tint[tier]
end
item.localised_name = (tier > 1 and {'phi-cl.combine', {'?', {'equipment-name.' .. source.ref_name}, {'name.' .. source.ref_name}}, tostring(tier)}) or {'?', {'equipment-name.' .. source.ref_name}, {'name.' .. source.ref_name}}
item.localised_description = {'?', {'equipment-description.' .. source.ref_name}, {'description.' .. source.ref_name}}
data:extend({item})
end
-- MBQ A 48 BASE ARMOR_EQUIPMENT,RECIPE,RESEARCH_EFFECT -- MBQ A 48 BASE ARMOR_EQUIPMENT,RECIPE,RESEARCH_EFFECT
-- MBQ A 8 SPACE_AGE ARMOR_EQUIPMENT,RECIPE,RESEARCH_EFFECT -- MBQ A 8 SPACE_AGE ARMOR_EQUIPMENT,RECIPE,RESEARCH_EFFECT
for _, v in pairs(items) do for _, v in pairs(items) do
@@ -119,7 +167,7 @@ for _, v in pairs(items) do
v.category = 'equipment' v.category = 'equipment'
for j=v.min, v.max, 1 do for j=v.min, v.max, 1 do
main.EEQ(v, j) equipment(v, j)
main.EI(v, j) main.EI(v, j)
main.ER(v, j) main.ER(v, j)
main.ET(v, j) main.ET(v, j)