mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
add / remove Culture creates / removes Folk religion
This commit is contained in:
parent
05a45fca86
commit
6d9c8df651
3 changed files with 71 additions and 15 deletions
|
|
@ -519,10 +519,11 @@ function cultureRegenerateBurgs() {
|
|||
}
|
||||
|
||||
function removeCulture(cultureId) {
|
||||
// and the Folk religion
|
||||
cults.select("#culture" + cultureId).remove();
|
||||
debug.select("#cultureCenter" + cultureId).remove();
|
||||
|
||||
const {burgs, states, cells, cultures} = pack;
|
||||
const {burgs, states, cells, cultures, religions} = pack;
|
||||
|
||||
burgs.filter(b => b.culture == cultureId).forEach(b => (b.culture = 0));
|
||||
states.forEach(s => {
|
||||
|
|
@ -531,7 +532,11 @@ function removeCulture(cultureId) {
|
|||
cells.culture.forEach((c, i) => {
|
||||
if (c === cultureId) cells.culture[i] = 0;
|
||||
});
|
||||
cells.religion.forEach((r, i) => {
|
||||
if (r === cultureId) cells.religion[i] = 0;
|
||||
})
|
||||
cultures[cultureId].removed = true;
|
||||
religions[cultureId].removed = true;
|
||||
|
||||
cultures
|
||||
.filter(c => c.i && !c.removed)
|
||||
|
|
@ -539,6 +544,12 @@ function removeCulture(cultureId) {
|
|||
c.origins = c.origins.filter(origin => origin !== cultureId);
|
||||
if (!c.origins.length) c.origins = [0];
|
||||
});
|
||||
religions
|
||||
.filter(r => r.i && !r.removed)
|
||||
.forEach(r => {
|
||||
r.origins = r.origins.filter(origin => origin !== cultureId);
|
||||
if (!r.origins.length) r.origins = [0];
|
||||
});
|
||||
refreshCulturesEditor();
|
||||
}
|
||||
|
||||
|
|
@ -548,7 +559,7 @@ function cultureRemovePrompt() {
|
|||
const cultureId = +this.parentNode.dataset.id;
|
||||
confirmationDialog({
|
||||
title: "Remove culture",
|
||||
message: "Are you sure you want to remove the culture? <br>This action cannot be reverted",
|
||||
message: "Are you sure you want to remove the culture? <br>The linked folk religion will also be removed. <br>This action cannot be reverted",
|
||||
confirm: "Remove",
|
||||
onConfirm: () => removeCulture(cultureId)
|
||||
});
|
||||
|
|
@ -823,6 +834,7 @@ function addCulture() {
|
|||
|
||||
if (d3.event.shiftKey === false) exitAddCultureMode();
|
||||
Cultures.add(center);
|
||||
Religions.addFolk(center);
|
||||
|
||||
drawCultureCenters();
|
||||
culturesEditorAddLines();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue