From 37fcdc295e1e0b4b26aeaf0b74ebd931c42daea4 Mon Sep 17 00:00:00 2001 From: Theodore Kruczek Date: Wed, 14 Aug 2024 22:15:26 -0400 Subject: [PATCH] fix: :bug: fix missiles causing search errors --- src/plugins/missile/missileManager.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/missile/missileManager.ts b/src/plugins/missile/missileManager.ts index 6dfcdae69..24af744e1 100644 --- a/src/plugins/missile/missileManager.ts +++ b/src/plugins/missile/missileManager.ts @@ -40,11 +40,21 @@ export const MassRaidPre = async (time: number, simFile: string) => { // Add the missile to the catalog catalogManagerInstance.objectCache[x] = newMissileArray[i]; - catalogManagerInstance.objectCache[x].velocity ??= { x: 0, y: 0, z: 0 } as EciVec3; // Set the velocity to 0 if it doesn't exist + if (!catalogManagerInstance.objectCache[x].velocity?.x) { + catalogManagerInstance.objectCache[x].velocity = { x: 0, y: 0, z: 0 } as EciVec3; + } catalogManagerInstance.objectCache[x].totalVelocity ??= 0; const missileObj = catalogManagerInstance.getObject(x) as MissileObject; + missileObj.isMissile = () => true; + missileObj.isMarker = () => false; + missileObj.isStatic = () => false; + missileObj.isSensor = () => false; + missileObj.isSatellite = () => false; + missileObj.isStar = () => false; + missileObj.isGroundObject = () => false; + if (missileObj) { missileObj.id = satSetLen - 500 + i; catalogManagerInstance.satCruncher.postMessage({ @@ -69,9 +79,11 @@ export const MassRaidPre = async (time: number, simFile: string) => { missileManager.missileArray = newMissileArray; }); - const uiManagerInstance = keepTrackApi.getUiManager(); + keepTrackApi.getUiManager().toast('Missile Mass Raid Loaded Successfully', ToastMsgType.normal); + settingsManager.searchLimit = settingsManager.searchLimit > 500 ? settingsManager.searchLimit : 500; + SettingsMenuPlugin.syncOnLoad(); - uiManagerInstance.doSearch('RV_'); + keepTrackApi.getUiManager().doSearch('RV_'); }; export const clearMissiles = () => { const uiManagerInstance = keepTrackApi.getUiManager();