This commit is contained in:
33333-33333 2026-05-20 22:29:14 +09:00
commit 53eef3522c
7 changed files with 40 additions and 182 deletions

View file

@ -1,4 +1,4 @@
import { CUSTOM_NAMES, NAME_PARTS } from "./names.js";
import { CUSTOM_NAMES, NAME_PARTS, contextualDefaultName } from "./names.js";
import {
applyLandscapeUnitAdminPartition,
generateAdminRegions,
@ -569,25 +569,14 @@ function attachIdsAndNames(points, prefix, seed, kindOverride = null, nameFields
return points.map((p, i) => {
const id = `${prefix}-${i}`;
const kind = kindOverride || p.kind;
const customName = CUSTOM_NAMES[id];
const customProbability = NAME_PROBABILITIES?.customName ?? 1.0;
const useCustomName =
Boolean(customName) &&
hash2(i + prefix.length * 101, seed + i * 37, seed + 99991) < customProbability;
let name = useCustomName ? customName : null;
let name = CUSTOM_NAMES[id];
if (!name) {
for (let attempt = 0; attempt < 8; attempt++) {
name = defaultName(seed + prefix.length * 1000, id, { ...p, kind }, nameFields, attempt);
if (!usedNames || !usedNames.has(name)) break;
}
}
if (usedNames && name) usedNames.add(name);
if (usedNames) usedNames.add(name);
return {
...p,
id,