mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-23 23:57:23 +01:00
feat: add optional AI-based name generation for map entities
This commit is contained in:
parent
3f9a7702d4
commit
5b98f55bc7
20 changed files with 1393 additions and 7 deletions
|
|
@ -26,6 +26,7 @@ function editLake() {
|
|||
byId("lakeName").on("input", changeName);
|
||||
byId("lakeNameCulture").on("click", generateNameCulture);
|
||||
byId("lakeNameRandom").on("click", generateNameRandom);
|
||||
byId("lakeNameAi").on("click", generateNameAi);
|
||||
byId("lakeGroup").on("change", changeLakeGroup);
|
||||
byId("lakeGroupAdd").on("click", toggleNewGroupInput);
|
||||
byId("lakeGroupName").on("change", createNewGroup);
|
||||
|
|
@ -140,6 +141,17 @@ function editLake() {
|
|||
lake.name = lakeName.value = Names.getBase(rand(nameBases.length - 1));
|
||||
}
|
||||
|
||||
async function generateNameAi() {
|
||||
const lake = getLake();
|
||||
const cells = Array.from(pack.cells.i.filter(i => pack.cells.f[i] === lake.i));
|
||||
const culture = cells.length ? pack.cells.culture[cells[0]] : 0;
|
||||
try {
|
||||
lake.name = lakeName.value = await AiNames.generateName("lake", culture);
|
||||
} catch (error) {
|
||||
tip(error.message, true, "error", 4000);
|
||||
}
|
||||
}
|
||||
|
||||
function selectLakeGroup() {
|
||||
const lake = getLake();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue