Skip to content

Commit

Permalink
fix: 🐛 fix missiles causing search errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Aug 15, 2024
1 parent 49b65cd commit 37fcdc2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/plugins/missile/missileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Kilometers>; // 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<Kilometers>;
}
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({
Expand All @@ -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();
Expand Down

0 comments on commit 37fcdc2

Please sign in to comment.