From dd9652399db718b3bfb82b97123f5438959ba501 Mon Sep 17 00:00:00 2001 From: Thom van den Akker Date: Thu, 5 Dec 2024 11:24:58 +0100 Subject: [PATCH] Fix write issue when new research appears, updated submodule --- integrations/minecolonies/file-manager.ts | 13 +++++++++---- minecolonies | 2 +- src/content/research/accuracy.json | 2 +- src/content/research/coffee.json | 1 + src/content/research_effect/guardcrit.json | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 src/content/research/coffee.json create mode 100644 src/content/research_effect/guardcrit.json diff --git a/integrations/minecolonies/file-manager.ts b/integrations/minecolonies/file-manager.ts index 3f85aba446..d5c11e5f99 100644 --- a/integrations/minecolonies/file-manager.ts +++ b/integrations/minecolonies/file-manager.ts @@ -50,10 +50,15 @@ export async function getAllJsonFiles(directory: string): Prom */ export async function writeContentCollectionFile(key: string, name: string, content: string): Promise { 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; } diff --git a/minecolonies b/minecolonies index 597d985865..f2b2311a72 160000 --- a/minecolonies +++ b/minecolonies @@ -1 +1 @@ -Subproject commit 597d9858655ebd75b4325d59018d47f5098d963a +Subproject commit f2b2311a727613f1f06fe08be6f63aa908b67201 diff --git a/src/content/research/accuracy.json b/src/content/research/accuracy.json index 693f64db99..4106a727f8 100644 --- a/src/content/research/accuracy.json +++ b/src/content/research/accuracy.json @@ -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} \ No newline at end of file +{"tree":"combat","name":"Accuracy","requirements":[{"type":"building","building":"guardtower","level":1},{"type":"item","items":["minecraft/iron_ingot"],"quantity":16}],"effects":{"guardcrit":1},"researchLevel":1} \ No newline at end of file diff --git a/src/content/research/coffee.json b/src/content/research/coffee.json new file mode 100644 index 0000000000..46b35d1243 --- /dev/null +++ b/src/content/research/coffee.json @@ -0,0 +1 @@ +{"tree":"combat","parent":"tactictraining","name":"Coffee","requirements":[{"type":"item","items":["minecraft/golden_carrot"],"quantity":4}],"effects":{"sleeplessmultiplier":1},"researchLevel":2} \ No newline at end of file diff --git a/src/content/research_effect/guardcrit.json b/src/content/research_effect/guardcrit.json new file mode 100644 index 0000000000..411a98cd91 --- /dev/null +++ b/src/content/research_effect/guardcrit.json @@ -0,0 +1 @@ +{"type":"regular","format":"Guards have a chance to score critical hits","levels":[0.2,0.3,0.4,0.5]} \ No newline at end of file