mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
refactor: specify burgs fixes
This commit is contained in:
parent
7f57c9af65
commit
8c741a559e
6 changed files with 34 additions and 19 deletions
|
|
@ -1044,10 +1044,9 @@ window.COA = (function () {
|
|||
const shapeGroup = emblemShape.selectedOptions[0]?.parentNode.label || "Diversiform";
|
||||
|
||||
if (shapeGroup !== "Diversiform") return emblemShape.value;
|
||||
|
||||
if (emblemShape.value === "state" && stateShield) return stateShield;
|
||||
if (cultureShield) return cultureShield;
|
||||
|
||||
if (cultureShield) cultureShield;
|
||||
ERROR && console.error("Shield shape is not defined on culture level");
|
||||
return "heater";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export function createStates(capitals: TCapitals, cultures: TCultures) {
|
|||
const shield = COA.getShield(cultureShield, null);
|
||||
const coa: ICoa = {...COA.generate(null, null, null, type), shield};
|
||||
|
||||
return {i: id, center: cellId, type, name, color, expansionism, capital: capitalId, culture: cultureId, coa};
|
||||
return {i: id, name, type, center: cellId, color, expansionism, capital: capitalId, culture: cultureId, coa};
|
||||
});
|
||||
|
||||
TIME && console.timeEnd("createStates");
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ export function generateBurgsAndStates(
|
|||
cultures: TCultures,
|
||||
features: TPackFeatures,
|
||||
temp: Int8Array,
|
||||
rivers: Omit<IRiver, "name" | "basin" | "type">[],
|
||||
vertices: IGraphVertices,
|
||||
cells: Pick<
|
||||
IPack["cells"],
|
||||
|
|
@ -55,6 +56,7 @@ export function generateBurgsAndStates(
|
|||
vertices,
|
||||
cultures,
|
||||
states,
|
||||
rivers,
|
||||
pick(cells, "v", "p", "g", "h", "f", "haven", "harbor", "s", "biome", "fl", "r")
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export function specifyBurgs(
|
|||
vertices: IGraphVertices,
|
||||
cultures: TCultures,
|
||||
states: TStatesReturn,
|
||||
rivers: Omit<IRiver, "name" | "basin" | "type">[],
|
||||
cells: Pick<IPack["cells"], "v" | "p" | "g" | "h" | "f" | "haven" | "harbor" | "s" | "biome" | "fl" | "r">
|
||||
): TBurgs {
|
||||
TIME && console.time("specifyBurgs");
|
||||
|
|
@ -102,7 +103,11 @@ export function specifyBurgs(
|
|||
if (haven && (waterBody as TPackFeature).type === "lake") return "Lake";
|
||||
|
||||
if (cells.h[cellId] > ELEVATION.FOOTHILLS) return "Highland";
|
||||
if (cells.r[cellId] && rivers[cellId].length > 100) return "River";
|
||||
|
||||
if (cells.r[cellId]) {
|
||||
const river = rivers.find(river => river.i === cellId);
|
||||
if (river && river.length > 100) return "River";
|
||||
}
|
||||
|
||||
if (population < 6) {
|
||||
const biome = cells.biome[cellId];
|
||||
|
|
|
|||
|
|
@ -58,10 +58,10 @@ export const mergeLakeData = function (
|
|||
const lake = lakeData.find(lake => lake.i === feature.i);
|
||||
if (!lake) return feature;
|
||||
|
||||
const {firstCell, height, flux, temp, evaporation} = lake;
|
||||
const {firstCell, height, flux, temp, evaporation, cells} = lake;
|
||||
const inlets = lake.inlets?.filter(inlet => rivers.find(river => river.i === inlet));
|
||||
const outlet = rivers.find(river => river.i === lake.outlet)?.i;
|
||||
const group = defineLakeGroup({firstCell, height, flux, temp, evaporation, inlets, outlet});
|
||||
const group = defineLakeGroup({firstCell, height, flux, temp, evaporation, cells, inlets, outlet});
|
||||
|
||||
const lakeFeature: IPackFeatureLake = {...feature, flux, temp, evaporation, inlets, outlet, group};
|
||||
if (!inlets || !inlets.length) delete lakeFeature.inlets;
|
||||
|
|
@ -79,6 +79,7 @@ function defineLakeGroup({
|
|||
flux,
|
||||
temp,
|
||||
evaporation,
|
||||
cells,
|
||||
inlets,
|
||||
outlet
|
||||
}: {
|
||||
|
|
@ -87,6 +88,7 @@ function defineLakeGroup({
|
|||
flux: number;
|
||||
temp: number;
|
||||
evaporation: number;
|
||||
cells: number;
|
||||
inlets?: number[];
|
||||
outlet?: number;
|
||||
}): IPackFeatureLake["group"] {
|
||||
|
|
|
|||
|
|
@ -95,19 +95,26 @@ export function createPack(grid: IGrid): IPack {
|
|||
pop: population
|
||||
});
|
||||
|
||||
const {burgIds, stateIds, burgs, states} = generateBurgsAndStates(cultures, mergedFeatures, temp, vertices, {
|
||||
...pick(cells, "v", "c", "p", "i", "g"),
|
||||
h: heights,
|
||||
f: featureIds,
|
||||
t: distanceField,
|
||||
haven,
|
||||
harbor,
|
||||
r: riverIds,
|
||||
fl: flux,
|
||||
biome,
|
||||
s: suitability,
|
||||
culture: cultureIds
|
||||
});
|
||||
const {burgIds, stateIds, burgs, states} = generateBurgsAndStates(
|
||||
cultures,
|
||||
mergedFeatures,
|
||||
temp,
|
||||
rawRivers,
|
||||
vertices,
|
||||
{
|
||||
...pick(cells, "v", "c", "p", "i", "g"),
|
||||
h: heights,
|
||||
f: featureIds,
|
||||
t: distanceField,
|
||||
haven,
|
||||
harbor,
|
||||
r: riverIds,
|
||||
fl: flux,
|
||||
biome,
|
||||
s: suitability,
|
||||
culture: cultureIds
|
||||
}
|
||||
);
|
||||
|
||||
// Religions.generate();
|
||||
// BurgsAndStates.defineStateForms();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue