Skip to content

Commit

Permalink
Fix write issue when new research appears, updated submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
Thodor12 committed Dec 5, 2024
1 parent abe15af commit dd96523
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions integrations/minecolonies/file-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ export async function getAllJsonFiles<T extends object>(directory: string): Prom
*/
export async function writeContentCollectionFile(key: string, name: string, content: string): Promise<boolean> {
const fullPath = path.resolve(`src/content/${key}/${name}`);
const currentContent = await fs.readFile(fullPath, 'utf-8');
if (currentContent === content) {
return false;
try {
const currentContent = await fs.readFile(fullPath, 'utf-8');
if (currentContent === content) {
return false;
}
} catch {
// Ignore error
} finally {
await fs.writeFile(fullPath, content);
}
await fs.writeFile(fullPath, content);
return true;
}
2 changes: 1 addition & 1 deletion minecolonies
Submodule minecolonies updated 1378 files
2 changes: 1 addition & 1 deletion src/content/research/accuracy.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tree":"combat","name":"Accuracy","requirements":[{"type":"building","building":"guardtower","level":1},{"type":"item","items":["minecraft/iron_ingot"],"quantity":16}],"effects":{"sleeplessmultiplier":1},"researchLevel":1}
{"tree":"combat","name":"Accuracy","requirements":[{"type":"building","building":"guardtower","level":1},{"type":"item","items":["minecraft/iron_ingot"],"quantity":16}],"effects":{"guardcrit":1},"researchLevel":1}
1 change: 1 addition & 0 deletions src/content/research/coffee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"tree":"combat","parent":"tactictraining","name":"Coffee","requirements":[{"type":"item","items":["minecraft/golden_carrot"],"quantity":4}],"effects":{"sleeplessmultiplier":1},"researchLevel":2}
1 change: 1 addition & 0 deletions src/content/research_effect/guardcrit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"regular","format":"Guards have a chance to score critical hits","levels":[0.2,0.3,0.4,0.5]}

0 comments on commit dd96523

Please sign in to comment.