From 075d54f7088354e8e1d9dcf8467696d24d2b39a6 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 12 Oct 2019 02:01:46 +0200 Subject: [PATCH] Filter out lower levels when syncing research Fix the next level of an infinite research getting updated with the progress of the previous level from other nodes in the cluster by filtering out infinite researches with a lower level than the local level. --- CHANGELOG.md | 2 ++ sharedPlugins/researchSync/index.js | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee540aaa..994793f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Version 1.2.2 Object prototype property in researchSync. - Fixed progress of a current infinite tech carrying over to the next one when researching it and another node completes it in researchSync. +- Fixed progress of a previous infinite tech from another node being applied + to the current one in researchSync. Version 1.2.1 diff --git a/sharedPlugins/researchSync/index.js b/sharedPlugins/researchSync/index.js index a2e7a840..17ee5c09 100644 --- a/sharedPlugins/researchSync/index.js +++ b/sharedPlugins/researchSync/index.js @@ -278,6 +278,12 @@ class ResearchSync { } if (isNaN(cluster_techs[name].progress)) continue + + // Do not update progress for infinite techs with a local level that's higher. + if (tech.infinite && tech.level > cluster_techs[name].level) { + continue; + } + if (tech.progress < cluster_techs[name].progress) result[name] = cluster_techs[name] }