mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 02:21:24 +01:00
refactor: lake name generator
This commit is contained in:
parent
4b874246e3
commit
b2f16c4b8f
6 changed files with 25 additions and 27 deletions
|
|
@ -1,9 +1,10 @@
|
|||
// @ts-nocheckd
|
||||
import * as d3 from "d3";
|
||||
|
||||
import {rn} from "utils/numberUtils";
|
||||
import {getRealHeight} from "utils/unitUtils";
|
||||
|
||||
const {Names} = window;
|
||||
|
||||
export interface ILakeClimateData extends IPackFeatureLake {
|
||||
flux: number;
|
||||
temp: number;
|
||||
|
|
@ -45,7 +46,7 @@ export const getClimateData = function (
|
|||
return lakeData;
|
||||
};
|
||||
|
||||
export const mergeLakeDataToFeatures = function (
|
||||
export const mergeLakeData = function (
|
||||
features: TPackFeatures,
|
||||
lakeData: ILakeClimateData[],
|
||||
rivers: Pick<IRiver, "i">[]
|
||||
|
|
@ -101,3 +102,17 @@ function defineLakeGroup({
|
|||
|
||||
return "freshwater";
|
||||
}
|
||||
|
||||
export function generateLakeNames(features: TPackFeatures, culture: UintArray) {
|
||||
const updatedFeatures = features.map(feature => {
|
||||
if (!feature) return 0;
|
||||
if (feature.type !== "lake") return feature;
|
||||
|
||||
const landCell = feature.shoreline[0];
|
||||
const cultureId = culture[landCell];
|
||||
const name = Names.getCulture(cultureId) as string;
|
||||
return {...feature, name};
|
||||
});
|
||||
|
||||
return updatedFeatures as TPackFeatures;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue