mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Religions live update UX (#915)
* preparatory bugfixes
* restructure religion generator for extensibility
* Add culture-like update functions and UI
* Syntax / Typo
* PR Versioning
* Relig Editor UI: hide on brush, limit -> potential
* add / remove Culture creates / removes Folk religion
* Religions UX: stable abbr, Folk non-selectable type & not separately removed
* Folk religions follow cultures through regeneration; extinct religion centers draw, folk centers are immutable and do not
* style
* regenerate bugs fixing
* when cultures regenerate a different number
* ability to lock culture in a easy-defined set
fixes uncaught error in commit dada419 from PR #910
* what is locked folk?
* New Map ignores old locked things
* No auto-update of religion on culture regeneration
* typo
* Bugfixes
* Refactor toward modern style
* Prepare to lock - Further refactor
* Complete locked religions functionality
* Prepare for live updates
* Editors fixing + re-versioning
* Fix merge snafu
* Bugs, toungue-twisting
* indexing bugfix
* Manual Add prefers to create missing Folk
* Locked origin regen; deterministic expansion
* version update; fix add wild folk
---------
Co-authored-by: A C James <james.ander31@gmail.com>
Co-authored-by: Azgaar <maxganiev@yandex.ru>
This commit is contained in:
parent
efb5ad8091
commit
47ef8d938b
7 changed files with 511 additions and 394 deletions
|
|
@ -118,21 +118,23 @@ window.Cultures = (function () {
|
|||
|
||||
function selectCultures(culturesNumber) {
|
||||
let def = getDefault(culturesNumber);
|
||||
if (culturesNumber === def.length) return def;
|
||||
if (def.every(d => d.odd === 1)) return def.splice(0, culturesNumber);
|
||||
|
||||
const count = Math.min(culturesNumber, def.length);
|
||||
|
||||
const cultures = [];
|
||||
|
||||
pack.cultures?.forEach(function (culture) {
|
||||
if (culture.lock) cultures.push(culture);
|
||||
});
|
||||
|
||||
if (!cultures.length) {
|
||||
if (culturesNumber === def.length) return def;
|
||||
if (def.every(d => d.odd === 1)) return def.splice(0, culturesNumber);
|
||||
}
|
||||
|
||||
for (let culture, rnd, i = 0; cultures.length < count && i < 200; i++) {
|
||||
for (let culture, rnd, i = 0; cultures.length < culturesNumber && def.length > 0;) {
|
||||
do {
|
||||
rnd = rand(def.length - 1);
|
||||
culture = def[rnd];
|
||||
} while (!P(culture.odd));
|
||||
i++;
|
||||
} while (i < 200 && !P(culture.odd));
|
||||
cultures.push(culture);
|
||||
def.splice(rnd, 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue