refactor: migrate cultures generator (#1287)
Some checks are pending
Deploy static content to Pages / deploy (push) Waiting to run
Code quality / quality (push) Waiting to run

* refactor: migrate cultures generator

* Update src/modules/cultures-generator.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore:lint

* fix: wrong call structure

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Marc Emmanuel 2026-01-27 21:00:55 +01:00 committed by GitHub
parent 260ccd76a3
commit 3807903cae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 1419 additions and 622 deletions

View file

@ -8494,7 +8494,6 @@
<script defer src="config/heightmap-templates.js"></script>
<script defer src="config/precreated-heightmaps.js"></script>
<script defer src="modules/ice.js?v=1.111.0"></script>
<script defer src="modules/cultures-generator.js?v=1.106.0"></script>
<script defer src="modules/burgs-generator.js?v=1.109.5"></script>
<script defer src="modules/states-generator.js?v=1.107.0"></script>
<script defer src="modules/provinces-generator.js?v=1.106.0"></script>

File diff suppressed because it is too large Load diff

View file

@ -6,3 +6,4 @@ import "./ocean-layers";
import "./lakes";
import "./river-generator";
import "./biomes";
import "./cultures-generator";

View file

@ -1,3 +1,4 @@
import type { Culture } from "../modules/cultures-generator";
import type { PackedGraphFeature } from "../modules/features";
import type { River } from "../modules/river-generator";
@ -19,15 +20,18 @@ export interface PackedGraph {
b: boolean[]; // cell is on border
h: TypedArray; // cell heights
t: TypedArray; // cell terrain types
r: Uint16Array; // river id passing through cell
f: Uint16Array; // feature id occupying cell
r: TypedArray; // river id passing through cell
f: TypedArray; // feature id occupying cell
fl: TypedArray; // flux presence in cell
s: TypedArray; // cell suitability
pop: TypedArray; // cell population
conf: TypedArray; // cell water confidence
haven: TypedArray; // cell is a haven
g: number[]; // cell ground type
culture: number[]; // cell culture id
biome: TypedArray; // cell biome id
harbor: TypedArray; // cell harbour presence
area: TypedArray; // cell area
};
vertices: {
i: number[]; // vertex indices
@ -39,5 +43,5 @@ export interface PackedGraph {
};
rivers: River[];
features: PackedGraphFeature[];
cultures: any[];
cultures: Culture[];
}

View file

@ -16,7 +16,10 @@ declare global {
var nameBases: NameBase[];
var pointsInput: HTMLInputElement;
var culturesInput: HTMLInputElement;
var culturesSet: HTMLSelectElement;
var heightExponentInput: HTMLInputElement;
var alertMessage: HTMLElement;
var mapName: HTMLInputElement;
var rivers: Selection<SVGElement, unknown, null, undefined>;
@ -31,6 +34,8 @@ declare global {
icons: string[][];
cost: number[];
};
var COA: any;
var FlatQueue: any;
var tip: (
message: string,
@ -39,4 +44,5 @@ declare global {
) => void;
var locked: (settingId: string) => boolean;
var unlock: (settingId: string) => void;
var $: (selector: any) => any;
}