Skip to content

Commit

Permalink
add remove duplicated ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Lredigonda committed Sep 16, 2024
1 parent 5af7f39 commit e8776a1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/interactor/src/libs/exportToRenpy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ export const downloadRenPyProject = async (
try {
let allBackgroundAssets: string[] = [];
let allCharactersImages: string[] = [];
const removeDuplicates = (strings: string[]): string[] => {
return Array.from(new Set(strings));
};
// const allBackgroundAssets = state.novel.backgrounds.map((background) => background.source.jpg);
// const allCharactersImages = state.novel.characters
// .map((character) => {
Expand Down Expand Up @@ -405,11 +408,17 @@ export const downloadRenPyProject = async (
}
const sceneBackground = state.novel.backgrounds.find((background) => background.id === scene.backgroundId);
if (sceneBackground) {
allBackgroundAssets.push(sceneBackground.source.jpg);
if (!allBackgroundAssets.includes(sceneBackground.source.jpg)) {
allBackgroundAssets.push(sceneBackground.source.jpg);
}
}
}
}
}
allCharactersImages = allCharactersImages.filter((item) => item !== '');

allBackgroundAssets = removeDuplicates(allBackgroundAssets);
allCharactersImages = removeDuplicates(allCharactersImages);

// eslint-disable-next-line
// @ts-ignore
Expand Down

0 comments on commit e8776a1

Please sign in to comment.