diff --git a/data/resources.js b/data/resources.js index ddbff606..472295f9 100644 --- a/data/resources.js +++ b/data/resources.js @@ -528,8 +528,8 @@ window.FMG.data.resourceModels = { Any_forest: 'biome(5, 6, 7, 8, 9)', Temperate_and_boreal_forests: 'biome(6, 8, 9)', Hills: 'minHeight(40) || (minHeight(30) && nth(10))', - Mountains: 'minHeight(60) || (minHeight(40) && nth(10))', - Mountains_and_wetlands: 'minHeight(60) || (biome(12) && nth(8))', + Mountains: 'minHeight(60) || (minHeight(20) && nth(10))', + Mountains_and_wetlands: 'minHeight(60) || (biome(12) && nth(7)) || (minHeight(20) && nth(10))', Headwaters: 'river() && minHeight(40)', More_habitable: 'minHabitability(20) && habitability()', Marine_and_rivers: 'shore(-1) && (type("ocean", "freshwater", "salt") || (river() && shore(1, 2)))', diff --git a/main.js b/main.js index aeead32a..0b8d3fd1 100644 --- a/main.js +++ b/main.js @@ -1566,7 +1566,6 @@ function rankCells() { flMax = d3.max(cells.fl) + d3.max(cells.conf); // to normalize flux const areaMean = d3.mean(cells.area); // to adjust population by cell area const getResValue = (i) => (cells.resource[i] ? Resources.get(cells.resource[i])?.value : 0); // get bonus resource scope - const resBonuses = []; const POP_BALANCER = 1.5; // to ballance population to desired number for (const i of cells.i) { @@ -1598,13 +1597,10 @@ function rankCells() { const cellRes = getResValue(i); const neibRes = d3.mean(cells.c[i].map((c) => getResValue(c))); const resBonus = (cellRes ? cellRes + 10 : 0) + neibRes; - resBonuses.push(resBonus); // cell rural population is suitability adjusted by cell area cells.pop[i] = s > 0 ? (s * POP_BALANCER * cells.area[i]) / areaMean : 0; cells.s[i] = s + resBonus; - - // debug.append('text').attr('x', cells.p[i][0]).attr('y', cells.p[i][1]).text(cells.s[i]); } TIME && console.timeEnd("rankCells"); diff --git a/modules/ui/burg-editor.js b/modules/ui/burg-editor.js index afd10c0e..d22200c9 100644 --- a/modules/ui/burg-editor.js +++ b/modules/ui/burg-editor.js @@ -163,12 +163,12 @@ function editBurg(id) { return `${totalIncome}: ${exported.join('')}`; } - function getProduction(resources) { + function getProduction(pool) { let html = ''; - for (const resourceId in resources) { + for (const resourceId in pool) { const {name, unit, icon} = Resources.get(+resourceId); - const production = resources[resourceId]; + const production = pool[resourceId]; const unitName = production > 1 ? unit + 's' : unit; html += ` @@ -180,6 +180,24 @@ function editBurg(id) { return html; } + function getExport(dealsArray) { + if (!dealsArray.length) return 'no'; + + const totalIncome = d3.sum(dealsArray.map((deal) => deal.burgIncome)); + const exported = dealsArray.map((deal) => { + const {resourceId, quantity, burgIncome} = deal; + const {name, unit, icon} = Resources.get(resourceId); + const unitName = quantity > 1 ? unit + 's' : unit; + + return ` + + ${quantity} + `; + }); + + return `${totalIncome}: ${exported.join('')}`; + } + // [-1; 31] °C, source: https://en.wikipedia.org/wiki/List_of_cities_by_average_temperature function getTemperatureLikeness(temperature) { if (temperature < -15) return 'nowhere in the real-world';