mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
Folk religions follow cultures through regeneration; extinct religion centers draw, folk centers are immutable and do not
This commit is contained in:
parent
de3ed0d705
commit
81a19337a9
4 changed files with 48 additions and 23 deletions
|
|
@ -127,6 +127,27 @@ window.Cultures = (function () {
|
|||
pack.cultures?.forEach(function (culture) {
|
||||
if (culture.lock) cultures.push(culture);
|
||||
});
|
||||
if(pack.religions?.length){
|
||||
const religMap=[];
|
||||
pack.religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general
|
||||
for(const j = 0; j < cultures.length; j++) { // locked cultures save their folk religions, at the new id
|
||||
const k = j+1;
|
||||
religMap[cultures[j].i] = k;
|
||||
});
|
||||
for(const i of cells.i){
|
||||
cells.religion[i] = religMap[cells.religion[i]];
|
||||
}
|
||||
for(const i = 0; i < religMap.length; i++){
|
||||
// update origin heirarchy to the new ids
|
||||
pack.religions[i].origins = pack.religions[i].origins.map(i => religMap[i]).filter(i => i);
|
||||
if(religMap[i] !== i){
|
||||
if(religMap[i] !== 0)
|
||||
pack.religions[religMap[i]] = pack.religions[i];
|
||||
// folk religions for unlocked cultures are removed pending regeneration
|
||||
pack.religions[i].removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let culture, rnd, i = 0; cultures.length < count && i < 200; i++) {
|
||||
do {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue