mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-12 10:45:54 +00:00
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:
13
assets/js/hooks/Mapper/helpers/getWhSize.ts
Normal file
13
assets/js/hooks/Mapper/helpers/getWhSize.ts
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user