mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 10:01:23 +01:00
refactor: generate states cleanup
This commit is contained in:
parent
c2fc0679ad
commit
ff974a4fd0
16 changed files with 98 additions and 64 deletions
|
|
@ -162,10 +162,9 @@ window.Names = (function () {
|
|||
};
|
||||
|
||||
// generate state name based on capital or random name and culture-specific suffix
|
||||
const getState = function (name, culture, base) {
|
||||
const getState = function (name, base) {
|
||||
if (name === undefined) return ERROR && console.error("Please define a base name");
|
||||
if (culture === undefined && base === undefined) return ERROR && console.error("Please define a culture");
|
||||
if (base === undefined) base = pack.cultures[culture].base;
|
||||
if (base === undefined) return ERROR && console.error("Please define a namesbase");
|
||||
|
||||
// exclude endings inappropriate for states name
|
||||
if (name.includes(" ")) name = capitalize(name.replace(/ /g, "").toLowerCase()); // don't allow multiword state names
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue