local items = require('mbq-c') 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} } if settings.startup['PHI-MB-EQUIPMENT-ARMOR'].value then -- MBQ A 1 ARMOR_GRID local grid = table.deepcopy(data.raw['equipment-grid']['large-equipment-grid']) grid.name = 'equipment-grid-14x14' grid.width = 14 grid.height = 14 data:extend({grid}) -- MBQ A 1 ARMOR local armor = table.deepcopy(data.raw['armor']['power-armor-mk2']) armor.name = 'power-armor-mk3' armor.icons = {{icon = armor.icon, tint = mod_tint[2], icon_size = armor.icon_size}} armor.icon = nil armor.icon_size = nil for _, v in pairs(armor.resistances) do v.decrease = v.decrease + 10 v.percent = ((v.percent < 90) and v.percent + 10) or v.percent end armor.order = armor.order .. '-2' armor.equipment_grid = 'equipment-grid-14x14' armor.inventory_size_bonus = armor.inventory_size_bonus + 10 armor.localised_name = {'phi-cl.combine-gen', {'item-name.power-armor-mk2'}, '3'} data:extend({armor}) -- MBQ A 1 RECIPE data:extend({{ type = 'recipe', name = armor.name, energy_required = 2, enabled = false, categories = {'crafting'}, ingredients = {{type = 'item', name = 'power-armor-mk2', amount = 2}}, results = {{type = 'item', name = armor.name, amount = 1}}, main_product = armor.name, localised_name = {'phi-cl.combine-gen', {'item-name.power-armor-mk2'}, '3'} }}) -- MBQ A 1 RESEARCH_EFFECT table.insert(data.raw.technology['power-armor-mk2'].effects, {type = 'unlock-recipe', recipe = armor.name}) if mods['space-age'] then -- MBQ A 1 ARMOR_GRID grid = table.deepcopy(data.raw['equipment-grid']['large-equipment-grid']) grid.name = 'equipment-grid-15x16' grid.width = 15 grid.height = 16 data:extend({grid}) -- MBQ A 1 ARMOR armor = table.deepcopy(data.raw['armor']['mech-armor']) armor.name = 'mech-armor-mk2' armor.icons = {{icon = armor.icon, tint = mod_tint[2], icon_size = armor.icon_size}} armor.icon = nil armor.icon_size = nil for _, v in pairs(armor.resistances) do v.decrease = v.decrease + 10 v.percent = ((v.percent < 90) and v.percent + 10) or v.percent end armor.order = armor.order .. '-2' armor.equipment_grid = 'equipment-grid-15x16' armor.inventory_size_bonus = armor.inventory_size_bonus + 10 armor.localised_name = {'phi-cl.combine-gen', {'item-name.mech-armor'}, '2'} data:extend({armor}) -- MBQ A 1 RECIPE data:extend({{ type = 'recipe', name = armor.name, energy_required = 2, enabled = false, categories = {'crafting'}, ingredients = {{type = 'item', name = 'mech-armor', amount = 2}}, results = {{type = 'item', name = armor.name, amount = 1}}, main_product = armor.name, localised_name = {'phi-cl.combine-gen', {'item-name.mech-armor'}, '2'} }}) -- MBQ A 1 RESEARCH_EFFECT table.insert(data.raw.technology['mech-armor'].effects, {type = 'unlock-recipe', recipe = armor.name}) end for _, an in ipairs(data.raw['character']['character']['animations']) do if an.armors then for _, ar in ipairs(an.armors) do if ar == 'power-armor-mk2' then table.insert(an.armors, 'power-armor-mk3') elseif ar == 'mech-armor' then table.insert(an.armors, 'mech-armor-mk2') end end end end end function main_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 function main_item(source, tier) local item = table.deepcopy(data.raw.item[source.ref_name]) item.name = source.name .. '-mk' .. tier .. '-equipment' item['place_as_equipment_result'] = item.name if item.icons and item.icons[1] then item.icons[1].tint = mod_tint[tier] elseif item.icon then item.icons = {{icon = item.icon, icon_size = (item.icon_size and item.icon_size) or nil, tint = mod_tint[tier]}} item.icon = nil end table.insert(item.icons, {icon = '__base__/graphics/icons/signal/signal_' .. tier .. '.png', icon_size = 64, scale = 0.25, shift = {12, 12}}) item.order = item.order .. tier item.localised_name = (tier > 1 and {'phi-cl.combine', {'?', {'entity-name.' .. source.ref_name}, {'equipment-name.' .. source.ref_name}, {'item-name.' .. source.ref_name}, {'name.' .. source.ref_name}}, tostring(tier)}) or {'?', {'entity-name.' .. source.ref_name}, {'equipment-name.' .. source.ref_name}, {'item-name.' .. source.ref_name}, {'name.' .. source.ref_name}} item.localised_description = {'?', {'entity-description.' .. source.ref_name}, {'equipment-description.' .. source.ref_name}, {'item-description.' .. source.ref_name}, {'description.' .. source.ref_name}} data:extend({item}) end function main_recipe(source, tier) local result_name = source.name .. '-mk' .. tier .. '-equipment' data:extend({{ type = 'recipe', name = result_name, icons = table.deepcopy(data.raw.item[source.ref_name].icons), energy_required = 2, enabled = false, categories = {'crafting'}, auto_recycle = data.raw.recipe[source.ref_name].auto_recycle, maximum_productivity = data.raw.recipe[source.ref_name].maximum_productivity, surface_conditions = data.raw.recipe[source.ref_name].surface_conditions, ingredients = {{type = 'item', name = (tier == source.min and source.ref_name) or (source.name .. '-mk' .. (tier - 1) .. '-equipment'), amount = 2}}, results = {{type = 'item', name = result_name, amount = 1}}, main_product = result_name, localised_name = {'?', data.raw[source.type][result_name].localised_name, ''}, localised_description = {'?', data.raw[source.type][result_name].localised_description, ''} }}) end function main_technology(source, tier) if not data.raw.technology[source.tech] then return end if not data.raw.technology[source.tech].effects then data.raw.technology[source.tech].effects = {} end table.insert(data.raw.technology[source.tech].effects, {type = 'unlock-recipe', recipe = source.name .. '-mk' .. tier .. '-equipment'}) end -- MBQ A 48 BASE ARMOR_EQUIPMENT,RECIPE,RESEARCH_EFFECT -- MBQ A 8 SPACE_AGE ARMOR_EQUIPMENT,RECIPE,RESEARCH_EFFECT for _, v in pairs(items) do v.mod = v.mod or 'base' v.min = v.min or 2 v.ref_name = v.ref_name or v.name .. '-equipment' if (v.mod and mods[v.mod]) and (v.max >= v.min) and data.raw[v.type] and data.raw[v.type][v.ref_name] and not data.raw[v.type][v.ref_name].hidden then for j=v.min, v.max, 1 do main_equipment(v, j) main_item(v, j) main_recipe(v, j) main_technology(v, j) end end end -- MBQ C 11 BASE ARMOR_EQUIPMENT if settings.startup['PHI-MB-EQUIPMENT-SIZE'].value then for _, e in pairs({'night-vision-equipment', 'energy-shield-equipment', 'battery-equipment', 'solar-panel-equipment', 'generator-equipment','active-defense-equipment', 'movement-bonus-equipment', 'roboport-equipment', 'belt-immunity-equipment', 'inventory-bonus-equipment'}) do if data.raw[e] then for _, v in pairs(data.raw[e]) do v.shape = {width = 1, height = 1, type = 'full', points = {{0, 0}}} end end end end if data.raw['battery-equipment'] and data.raw['battery-equipment']['battery-equipment'] and settings.startup['PHI-MB-EQUIPMENT'].value > 1 then for i = 4, settings.startup['PHI-MB-EQUIPMENT'].value + 2 do if data.raw['battery-equipment']['battery-mk' .. i .. '-equipment'] then data.raw['battery-equipment']['battery-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.battery-equipment'}, tostring(i)} data.raw['item']['battery-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.battery-equipment'}, tostring(i)} data.raw['recipe']['battery-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.battery-equipment'}, tostring(i)} end end end if data.raw['energy-shield-equipment'] and data.raw['energy-shield-equipment']['energy-shield-equipment'] and settings.startup['PHI-MB-EQUIPMENT'].value > 1 then for i = 3, settings.startup['PHI-MB-EQUIPMENT'].value + 1 do if data.raw['energy-shield-equipment']['energy-shield-mk' .. i .. '-equipment'] then data.raw['energy-shield-equipment']['energy-shield-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.energy-shield-equipment'}, tostring(i)} data.raw['item']['energy-shield-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.energy-shield-equipment'}, tostring(i)} data.raw['recipe']['energy-shield-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.energy-shield-equipment'}, tostring(i)} end end end if data.raw['roboport-equipment'] and data.raw['roboport-equipment']['personal-roboport-equipment'] and settings.startup['PHI-MB-EQUIPMENT'].value > 1 then for i = 3, settings.startup['PHI-MB-EQUIPMENT'].value + 1 do if data.raw['roboport-equipment']['personal-roboport-mk' .. i .. '-equipment'] then data.raw['roboport-equipment']['personal-roboport-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.personal-roboport-equipment'}, tostring(i)} data.raw['item']['personal-roboport-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.personal-roboport-equipment'}, tostring(i)} data.raw['recipe']['personal-roboport-mk' .. i .. '-equipment'].localised_name = {'phi-cl.combine', {'equipment-name.personal-roboport-equipment'}, tostring(i)} end end end