diff --git a/PHI-CL/data.lua b/PHI-CL/data.lua index c42ca09..4bf6cc2 100644 --- a/PHI-CL/data.lua +++ b/PHI-CL/data.lua @@ -274,17 +274,11 @@ if settings.startup['PHI-MI'].value then for _, t in pairs({data.raw['locomotive'], data.raw['cargo-wagon'], data.raw['fluid-wagon'], data.raw['artillery-wagon']}) do for _, v in pairs(t) do - if v.max_health then - v.max_health = v.max_health * s - end - - if v.max_speed then - v.max_speed = v.max_speed * s - end - - if v.braking_force then - v.braking_force = v.braking_force * s - end + v.max_health = (v.max_health and (v.max_health * s)) or nil + v.max_speed = (v.max_speed and (v.max_speed * s)) or nil + v.braking_force = (v.braking_force and (v.braking_force * s)) or nil + v.inventory_size = (v.inventory_size and math.ceil(v.inventory_size * s)) or nil + v.capacity = (v.capacity and math.ceil(v.capacity * s)) or nil if v.max_power then v.max_power = tostring(tonumber(string.match(v.max_power, '[%d%.]+')) * s) .. string.match(v.max_power, '%a+') @@ -294,14 +288,6 @@ if settings.startup['PHI-MI'].value then v.energy_source.burnt_inventory_size = 1 end end - - if v.inventory_size then - v.inventory_size = math.ceil(v.inventory_size * s) - end - - if v.capacity then - v.capacity = math.ceil(v.capacity * s) - end end end end @@ -451,16 +437,14 @@ if settings.startup['PHI-SA'].value then table.insert(data.raw.technology['cryogenic-plant'].effects, {type = 'unlock-recipe', recipe = 'unfreeze-' .. i.name}) end - spoil_handle(data.raw['item']['nutrients']) - spoil_handle(data.raw['item']['captive-biter-spawner']) - spoil_handle(data.raw['item']['biter-egg']) - spoil_handle(data.raw['item']['pentapod-egg']) - spoil_handle(data.raw['capsule']['raw-fish']) - spoil_handle(data.raw['capsule']['yumako-mash']) - spoil_handle(data.raw['capsule']['yumako']) - spoil_handle(data.raw['capsule']['jelly']) - spoil_handle(data.raw['capsule']['jellynut']) - spoil_handle(data.raw['capsule']['bioflux']) + for _, v in pairs({'nutrients', 'captive-biter-spawner', 'biter-egg', 'pentapod-egg'}) do + spoil_handle(data.raw['item'][v]) + end + + for _, v in pairs({'raw-fish', 'yumako-mash', 'yumako', 'jelly', 'jellynut', 'bioflux'}) do + spoil_handle(data.raw['capsule'][v]) + end + spoil_handle(data.raw.tool['agricultural-science-pack']) end @@ -471,16 +455,14 @@ if settings.startup['PHI-SA'].value then i.spoil_to_trigger_result = nil end - spoil_handle(data.raw['item']['nutrients']) - spoil_handle(data.raw['item']['captive-biter-spawner']) - spoil_handle(data.raw['item']['biter-egg']) - spoil_handle(data.raw['item']['pentapod-egg']) - spoil_handle(data.raw['capsule']['raw-fish']) - spoil_handle(data.raw['capsule']['yumako-mash']) - spoil_handle(data.raw['capsule']['yumako']) - spoil_handle(data.raw['capsule']['jelly']) - spoil_handle(data.raw['capsule']['jellynut']) - spoil_handle(data.raw['capsule']['bioflux']) + for _, v in pairs({'nutrients', 'captive-biter-spawner', 'biter-egg', 'pentapod-egg'}) do + spoil_handle(data.raw['item'][v]) + end + + for _, v in pairs({'raw-fish', 'yumako-mash', 'yumako', 'jelly', 'jellynut', 'bioflux'}) do + spoil_handle(data.raw['capsule'][v]) + end + spoil_handle(data.raw.tool['agricultural-science-pack']) data:extend({{ diff --git a/PHI-CL/main.lua b/PHI-CL/main.lua index cf794b5..75fc643 100644 --- a/PHI-CL/main.lua +++ b/PHI-CL/main.lua @@ -31,29 +31,12 @@ function main.EEE(source, tier) item.name = source.name .. '-' .. tier item.minable.result = item.name item.max_health = item.max_health * (tier - source.min + 2) - - if (tier < source.max) then - item.next_upgrade = source.name .. '-' .. (tier + 1) - end - - if item.production then - if source.tech == 'compound-energy' and source.type == 'solar-panel' then - item.production = tonumber(string.match(item.production, '[%d%.]+')) * (settings.startup['PHI-MB-ENERGY-SOLAR-RATIO'].value ^ (tier - source.min + 1)) .. (string.match(item.production, '%a+') or '') - - else - item.production = tonumber(string.match(item.production, '[%d%.]+')) * (2 ^ (tier - source.min + 1)) .. (string.match(item.production, '%a+') or '') - end - end + item.next_upgrade = ((tier < source.max) and source.name .. '-' .. (tier + 1)) or nil + item.production = (item.production and ((source.tech == 'compound-energy' and source.type == 'solar-panel') and (tonumber(string.match(item.production, '[%d%.]+')) * (settings.startup['PHI-MB-ENERGY-SOLAR-RATIO'].value ^ (tier - source.min + 1)) .. (string.match(item.production, '%a+') or ''))) or (tonumber(string.match(item.production, '[%d%.]+')) * (2 ^ (tier - source.min + 1)) .. (string.match(item.production, '%a+') or ''))) or nil for _, v in pairs({'energy_usage', 'heating_energy', 'crane_energy_usage', 'energy_per_shot', 'researching_speed', 'mining_speed', 'crafting_speed'}) do if not (source.tech == 'compound-energy' and (source.type == 'solar-panel' or source.type == 'accumulator')) and item[v] then - local n = tonumber(string.match(item[v], '[%d%.]+')) * (2 ^ (tier - source.min + 1)) - local a = string.match(item[v], '%a+') - item[v] = n - - if a then - item[v] = item[v] .. a - end + item[v] = (tonumber(string.match(item[v], '[%d%.]+')) * (2 ^ (tier - source.min + 1))) .. (string.match(item[v], '%a+') or '') end end @@ -65,16 +48,9 @@ function main.EEE(source, tier) end if item.energy_source.emissions_per_minute then - if source.tech == 'compound-energy' then - if (source.type == 'boiler') or (source.name == 'kr-gas-power-station') then - for k, _ in pairs(item.energy_source.emissions_per_minute) do - item.energy_source.emissions_per_minute[k] = item.energy_source.emissions_per_minute[k] * (tier - source.min + 2) - end - - else - for k, _ in pairs(item.energy_source.emissions_per_minute) do - item.energy_source.emissions_per_minute[k] = item.energy_source.emissions_per_minute[k] * (2 ^ (tier - source.min + 1)) - end + if source.tech == 'compound-energy' and ((source.type == 'boiler') or (source.name == 'kr-gas-power-station')) then + for k, _ in pairs(item.energy_source.emissions_per_minute) do + item.energy_source.emissions_per_minute[k] = item.energy_source.emissions_per_minute[k] * (tier - source.min + 2) end else @@ -89,32 +65,20 @@ function main.EEE(source, tier) if item.attack_parameters then item.attack_parameters.damage_modifier = 2 ^ (tier - source.min + 1) item.attack_parameters.range = item.attack_parameters.range + (2 * (tier - source.min + 1)) - - if item.attack_parameters.cooldown then - item.attack_parameters.cooldown = item.attack_parameters.cooldown * ((24 - tier + source.min) / 25) - end + item.attack_parameters.cooldown = (item.attack_parameters.cooldown and (item.attack_parameters.cooldown * ((24 - tier + source.min) / 25))) or nil end - if item.call_for_help_radius then - item.call_for_help_radius = item.call_for_help_radius + (2 * (tier - source.min + 1)) - end + item.call_for_help_radius = (item.call_for_help_radius and (item.call_for_help_radius + (2 * (tier - source.min + 1)))) or nil if source.type == 'electric-turret' then item.glow_light_intensity = 1 if item.attack_parameters then - if item.attack_parameters.damage_modifier and source.name == 'laser-turret' then - item.attack_parameters.damage_modifier = item.attack_parameters.damage_modifier * 2 - end + item.attack_parameters.damage_modifier = ((item.attack_parameters.damage_modifier and source.name == 'laser-turret') and (item.attack_parameters.damage_modifier * 2)) or nil if item.attack_parameters.ammo_type then - if item.attack_parameters.ammo_type.action and item.attack_parameters.ammo_type.action.action_delivery and item.attack_parameters.ammo_type.action.action_delivery.max_length then - item.attack_parameters.ammo_type.action.action_delivery.max_length = item.attack_parameters.ammo_type.action.action_delivery.max_length + (2 * (tier - source.min + 1)) - end - - if item.attack_parameters.ammo_type.energy_consumption then - item.attack_parameters.ammo_type.energy_consumption = 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+') - end + item.attack_parameters.ammo_type.action.action_delivery.max_length = ((item.attack_parameters.ammo_type.action and item.attack_parameters.ammo_type.action.action_delivery and item.attack_parameters.ammo_type.action.action_delivery.max_length) and (item.attack_parameters.ammo_type.action.action_delivery.max_length + (2 * (tier - source.min + 1)))) or nil + item.attack_parameters.ammo_type.energy_consumption = (item.attack_parameters.ammo_type.energy_consumption and (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 end end