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
This commit is contained in:
alpha02x
2025-02-26 14:33:16 +05:00
committed by GitHub
parent 9abcd4bd0b
commit d21705f355
4 changed files with 85 additions and 6 deletions

View File

@@ -0,0 +1,13 @@
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;
};