mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 18:11:24 +01:00
refactor: generate organized religions
This commit is contained in:
parent
70e8296c48
commit
cce374da24
8 changed files with 342 additions and 90 deletions
|
|
@ -6,6 +6,7 @@ import {minmax} from "utils/numberUtils";
|
|||
import type {createCapitals} from "./createCapitals";
|
||||
import type {createStates} from "./createStates";
|
||||
import {ELEVATION, FOREST_BIOMES, MIN_LAND_HEIGHT, DISTANCE_FIELD} from "config/generation";
|
||||
import {isState} from "utils/typeUtils";
|
||||
|
||||
type TCapitals = ReturnType<typeof createCapitals>;
|
||||
type TStates = ReturnType<typeof createStates>;
|
||||
|
|
@ -104,13 +105,9 @@ export function expandStates(
|
|||
|
||||
return normalizeStates(stateIds, capitalCells, cells.c, cells.h);
|
||||
|
||||
function isNeutrals(state: Entry<TStates>): state is TNeutrals {
|
||||
return state.i === 0;
|
||||
}
|
||||
|
||||
function getState(stateId: number) {
|
||||
const state = states[stateId];
|
||||
if (isNeutrals(state)) throw new Error("Neutrals cannot expand");
|
||||
if (!isState(state)) throw new Error("Neutrals cannot expand");
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue