mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-24 16:17: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
|
|
@ -45,6 +45,7 @@ function editRiver(id) {
|
|||
byId("riverType").on("input", changeType);
|
||||
byId("riverNameCulture").on("click", generateNameCulture);
|
||||
byId("riverNameRandom").on("click", generateNameRandom);
|
||||
byId("riverNameAi").on("click", generateNameAi);
|
||||
byId("riverMainstem").on("change", changeParent);
|
||||
byId("riverSourceWidth").on("input", changeSourceWidth);
|
||||
byId("riverWidthFactor").on("input", changeWidthFactor);
|
||||
|
|
@ -212,6 +213,17 @@ function editRiver(id) {
|
|||
if (r) r.name = riverName.value = Names.getBase(rand(nameBases.length - 1));
|
||||
}
|
||||
|
||||
async function generateNameAi() {
|
||||
const r = getRiver();
|
||||
if (!r) return;
|
||||
const culture = pack.cells.culture[r.mouth];
|
||||
try {
|
||||
r.name = riverName.value = await AiNames.generateName("river", culture);
|
||||
} catch (error) {
|
||||
tip(error.message, true, "error", 4000);
|
||||
}
|
||||
}
|
||||
|
||||
function changeParent() {
|
||||
const r = getRiver();
|
||||
r.parent = +this.value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue