ships.Function.sumMaterials - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / ships / sumMaterials
sumMaterials(...
lists):EngineeringMaterial[]
Defined in: src/ships/engineering.ts:493
Combine several material lists into one, summing the counts of any material that
appears in more than one list (matched by symbol, case-insensitively). Use it to
fold a blueprint's cost together with an experimental effect's — the two data modules
stay decoupled, so pass in whichever lists you have:
...readonly readonly EngineeringMaterial[][]
The material lists to merge; each may be empty.
One entry per distinct material, in first-seen order, with summed counts.
import { getBlueprintCost } from '@elite-dangerous-almanac/core/ships/blueprint-costs';
import { sumMaterials } from '@elite-dangerous-almanac/core/ships/engineering';
import { getExperimentalEffectCost } from '@elite-dangerous-almanac/core/ships/experimental-effect-costs';
sumMaterials(
getBlueprintCost('FSD_LongRange', 5)!.materials,
getExperimentalEffectCost('special_fsd_heavy')!,
);