Merge pull request #170 from MrRozdor/fix-researchsync

Fix researchSync that it counts progress only from techs on same level
This commit is contained in:
Godmave authored and GitHub committed 2019-07-17 07:16:48 +02:00
commit adf6763a0d
1 file changed
+12 -4
+12 -4
View File
@@ -154,11 +154,19 @@ class ResearchSync {
for (let [name, research] of Object.entries(cluster_researches))
research.progress = this.research[name].contribution
for (let slave_data of slaves_data)
for (let [name, research] of Object.entries(slave_data.meta.research))
if (cluster_researches[name]
&& !isNaN(cluster_researches[name].progress) && !isNaN(research.contribution))
for (let slave_data of slaves_data) {
for (let [name, research] of Object.entries(slave_data.meta.research)) {
if (!cluster_researches[name])
continue
if (isNaN(cluster_researches[name].progress)
|| isNaN(research.contribution)
|| isNaN(research.level)
|| isNaN(cluster_researches[name].level))
continue
if (cluster_researches[name].level === research.level)
cluster_researches[name].progress += research.contribution
}
}
for (let [name, research] of Object.entries(cluster_researches)) {
if (research.progress > 1) {