Skip to content

Commit

Permalink
feat: draw UI path for connected maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Trap committed Aug 6, 2024
1 parent 6dac025 commit 7bcd7d0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/path-to-tarkov-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,17 @@ export class PathToTarkovController {
this.entrypoints = getEntryPointsForMaps(this.db);
}

private getUIPaths(_indexedLocations: IndexedLocations): Path[] {
// TODO: use the ptt config to generate paths
// TODO: migrate in a different class

private getUIPaths(locations: ILocationBase[]): Path[] {
const newPaths: Path[] = [];

locations.forEach(sourceLocation => {
locations.forEach(destinationLocation => {
if (sourceLocation._Id !== destinationLocation._Id) {
newPaths.push({ Source: sourceLocation._Id, Destination: destinationLocation._Id });
}
});
});

return newPaths;
}

Expand All @@ -107,6 +113,7 @@ export class PathToTarkovController {
const indexedLocations = getIndexedLocations(locations);

const unlockedMaps = this.config.infiltrations[offraidPosition];
const unlockedLocationBases: ILocationBase[] = [];

MAPLIST.forEach(mapName => {
const locked = Boolean(!unlockedMaps[mapName as MapName]);
Expand All @@ -115,6 +122,7 @@ export class PathToTarkovController {
if (locationBase) {
if (!locked) {
this.debug(`[${sessionId}] unlock map ${mapName}`);
unlockedLocationBases.push(locationBase);
}

locationBase.Locked = locked;
Expand All @@ -125,7 +133,7 @@ export class PathToTarkovController {
}
});

const newPaths = this.getUIPaths(indexedLocations);
const newPaths = this.getUIPaths(unlockedLocationBases);
return { locations, paths: newPaths };
};
}
Expand Down

0 comments on commit 7bcd7d0

Please sign in to comment.