refactor: river generation start

This commit is contained in:
max 2022-07-19 02:01:56 +03:00
parent 4833a8ab35
commit 4e65616dbc
11 changed files with 285 additions and 265 deletions

36
src/types/pack/feature.d.ts vendored Normal file
View file

@ -0,0 +1,36 @@
interface IPackFeatureBase {
i: number; // feature id starting from 1
border: boolean; // if touches map border
cells: number; // number of cells
firstCell: number; // index of the top left cell
vertices: number[]; // indexes of perimetric vertices
area: number; // area of the feature perimetric polygon
}
3;
interface IPackFeatureOcean extends IPackFeatureBase {
land: false;
type: "ocean";
group: "ocean" | "sea" | "gulf";
}
interface IPackFeatureIsland extends IPackFeatureBase {
land: true;
type: "island";
group: "continent" | "island" | "isle" | "lake_island";
}
interface IPackFeatureLake extends IPackFeatureBase {
land: false;
type: "lake";
group: "freshwater" | "salt" | "frozen" | "dry" | "sinkhole" | "lava";
name: string;
shoreline: number[];
height: number;
}
type TPackFeature = IPackFeatureOcean | IPackFeatureIsland | IPackFeatureLake;
type FirstElement = 0;
type TPackFeatures = [FirstElement, ...TPackFeature[]];

View file

@ -37,37 +37,6 @@ interface IPackBase extends IGraph {
features?: TPackFeatures;
}
interface IPackFeatureBase {
i: number; // feature id starting from 1
border: boolean; // if touches map border
cells: number; // number of cells
firstCell: number; // index of the top left cell
vertices: number[]; // indexes of perimetric vertices
}
interface IPackFeatureOcean extends IPackFeatureBase {
land: false;
type: "ocean";
group: "ocean" | "sea" | "gulf";
}
interface IPackFeatureIsland extends IPackFeatureBase {
land: true;
type: "island";
group: "continent" | "island" | "isle" | "lake_island";
}
interface IPackFeatureLake extends IPackFeatureBase {
land: false;
type: "lake";
group: "freshwater" | "salt" | "frozen" | "dry" | "sinkhole" | "lava";
name: string;
}
type TPackFeature = IPackFeatureOcean | IPackFeatureIsland | IPackFeatureLake;
type TPackFeatures = [0, ...TPackFeature[]];
interface IState {
i: number;
name: string;