Files
wanderer/assets/js/hooks/Mapper/helpers/getWhSize.ts
alpha02x d21705f355 feat: Auto-set connection EOL status and ship size when linking/editing signatures (#194)
* feat: Automatically set connection EOL status and ship size type when linking/updating signatures
2025-02-26 13:33:16 +04:00

14 lines
532 B
TypeScript

import { SHIP_MASSES_SIZE } from '../components/map/constants';
import { ShipSizeStatus } from '../types/connection';
import { WormholeDataRaw } from '../types/wormholes';
export const getWhSize = (whDatas: WormholeDataRaw[], whType: string): ShipSizeStatus | null => {
if (whType === 'K162' || whType == null) return null;
const wormholeData = whDatas.find(wh => wh.name === whType);
if (!wormholeData?.max_mass_per_jump) return null;
return SHIP_MASSES_SIZE[wormholeData.max_mass_per_jump] ?? ShipSizeStatus.large;
};