mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
feat: slider-input - statesGrowthRate
This commit is contained in:
parent
794537131d
commit
bba23c6fc7
2 changed files with 12 additions and 39 deletions
|
|
@ -378,9 +378,9 @@ window.BurgsAndStates = (() => {
|
|||
const queue = new PriorityQueue({comparator: (a, b) => a.p - b.p});
|
||||
const cost = [];
|
||||
|
||||
const globalNeutralRate = byId("growthRate").valueAsNumber || 1;
|
||||
const statesNeutralRate = byId("statesNeutral")?.valueAsNumber || 1;
|
||||
const neutral = (cells.i.length / 2) * globalNeutralRate * statesNeutralRate; // limit cost for state growth
|
||||
const globalGrowthRate = byId("growthRate").valueAsNumber || 1;
|
||||
const statesGrowthRate = byId("statesGrowthRate")?.valueAsNumber || 1;
|
||||
const growthRate = (cells.i.length / 2) * globalGrowthRate * statesGrowthRate; // limit cost for state growth
|
||||
|
||||
// remove state from all cells except of locked
|
||||
for (const cellId of cells.i) {
|
||||
|
|
@ -419,7 +419,7 @@ window.BurgsAndStates = (() => {
|
|||
const cellCost = Math.max(cultureCost + populationCost + biomeCost + heightCost + riverCost + typeCost, 0);
|
||||
const totalCost = p + 10 + cellCost / states[s].expansionism;
|
||||
|
||||
if (totalCost > neutral) return;
|
||||
if (totalCost > growthRate) return;
|
||||
|
||||
if (!cost[e] || totalCost < cost[e]) {
|
||||
if (cells.h[e] >= 20) cells.state[e] = s; // assign state to cell
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue