mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Add the ability to regenerate cultures (#495)
* Add the ability to regenerate cultures - Added a button to the tools menu for regeneration. - Regeneration button will handle initial generation of cultures and expansion afterwards. - Pressing regenerate will warn the user. - Small cleanup of trailing whitespace. * Refreshing cultures editor updates culture centers * Regenerating cultures refreshes the culture editor * Added a function to refresh all open editors * Reset burg and state cultures after regeneration * Address the problem of potential data loss Any errors while iterating the states or burgs could potentially lose the index 0 metadata stored in the arrays. This will instead track the index and ignore the 0th result. * Religions update cultures on culture regeneration Updated function names to be more similar and more descriptive
This commit is contained in:
parent
cf0a446b6a
commit
fb28576f7c
6 changed files with 69 additions and 7 deletions
|
|
@ -279,6 +279,17 @@
|
|||
});
|
||||
}
|
||||
|
||||
function updateCultures() {
|
||||
console.time('updateCulturesForReligions');
|
||||
pack.religions = pack.religions.map( (religion, index) => {
|
||||
if(index === 0) {
|
||||
return religion;
|
||||
}
|
||||
return {...religion, culture: pack.cells.culture[religion.center]};
|
||||
});
|
||||
console.timeEnd('updateCulturesForReligions');
|
||||
}
|
||||
|
||||
// assign a unique two-letters code (abbreviation)
|
||||
function getCode(rawName) {
|
||||
const name = rawName.replace("Old ", ""); // remove Old prefix
|
||||
|
|
@ -350,6 +361,6 @@
|
|||
return type() + " of the " + generateMeaning();
|
||||
};
|
||||
|
||||
return {generate, add, getDeityName, expandReligions};
|
||||
return {generate, add, getDeityName, expandReligions, updateCultures};
|
||||
|
||||
})));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue