ships.Function.ammunitionCapacity - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / ships / ammunitionCapacity

Function: ammunitionCapacity()

ammunitionCapacity(stats): AmmunitionCapacity | null

Defined in: src/ships/ammunition.ts:108

What a module holds when fully rearmed.

Parameters

stats

AmmunitionStats | null | undefined

The module's stats. A catalogue record works as-is; pass a post-engineering record (FittedModule.effectiveStats, effectiveModule) to get the capacity a build actually flies with. Blueprints such as High Capacity and the chaff, heat-sink and point-defence capacity recipes move one figure or both, and experimental effects move the reserve: Corrosive Shell costs a fifth of it, and Plasma Slug (in both its forms) empties it, because the weapon then reloads from ship fuel.

Returns

AmmunitionCapacity | null

The AmmunitionCapacity, or null for a module that carries no ammunition at all — the lasers, which state neither figure because they draw from the weapons capacitor instead.

Remarks

Figures are reported as the stats give them. When engineering is simulated, its calculator makes both ammunition figures whole: a clip rounds up to a whole burst and a reserve rounds to the nearest whole round. A small cannon under High Capacity at grade 3 therefore loads an 11-round clip and carries a 202-round reserve. A journal states the engineered figures themselves, so imported values pass through untouched.

Example

import { ammunitionCapacity } from '@elite-dangerous-almanac/core/ships/ammunition';
import { getModuleBySymbol } from '@elite-dangerous-almanac/core/ships/modules';
import { HARDPOINT_MODULES } from '@elite-dangerous-almanac/core/ships/modules-hardpoint';
import { UTILITY_MODULES } from '@elite-dangerous-almanac/core/ships/modules-utility';

ammunitionCapacity(getModuleBySymbol('Hpt_ChaffLauncher_Tiny', UTILITY_MODULES)!);
// -> { clipSize: 1, hopper: 10, total: 11, unlimited: false }

ammunitionCapacity(getModuleBySymbol('Hpt_BeamLaser_Fixed_Small', HARDPOINT_MODULES)!);
// -> null — a beam laser has no ammunition to count
⚠️ **GitHub.com Fallback** ⚠️