prepare from trade generation

This commit is contained in:
Azgaar 2021-08-08 14:39:43 +03:00
parent ec468914e4
commit 2312d99760
4 changed files with 385 additions and 120 deletions

View file

@ -110,22 +110,5 @@ window.Production = (function () {
}
};
const defineExport = () => {
for (const burg of pack.burgs) {
if (!burg.i || burg.removed) continue;
const {population, production: resourcePool} = burg;
const localUsage = Math.ceil(population);
const surplus = {};
for (const resourceId in resourcePool) {
const production = resourcePool[resourceId];
const extraProduction = production - localUsage;
if (extraProduction > 0) surplus[resourceId] = extraProduction;
}
burg.export = surplus;
}
};
return {collectResources, defineExport};
return {collectResources};
})();