mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
prepare from trade generation
This commit is contained in:
parent
ec468914e4
commit
2312d99760
4 changed files with 385 additions and 120 deletions
|
|
@ -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};
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue