Editors fixing + re-versioning

This commit is contained in:
Canis Artorus 2023-03-03 23:52:47 -07:00
parent 4a0f2f1337
commit f532565f4f
7 changed files with 37 additions and 59 deletions

View file

@ -7864,10 +7864,10 @@
<script src="modules/river-generator.js"></script> <script src="modules/river-generator.js"></script>
<script src="modules/lakes.js"></script> <script src="modules/lakes.js"></script>
<script src="modules/names-generator.js?v=1.87.14"></script> <script src="modules/names-generator.js?v=1.87.14"></script>
<script src="modules/cultures-generator.js?v=1.90.00"></script> <script src="modules/cultures-generator.js?v=1.89.09"></script>
<script src="modules/burgs-and-states.js?v=1.89.07"></script> <script src="modules/burgs-and-states.js?v=1.89.07"></script>
<script src="modules/routes-generator.js"></script> <script src="modules/routes-generator.js"></script>
<script src="modules/religions-generator.js?v=1.90.00"></script> <script src="modules/religions-generator.js?v=1.89.09"></script>
<script src="modules/military-generator.js"></script> <script src="modules/military-generator.js"></script>
<script src="modules/markers-generator.js?v=1.87.13"></script> <script src="modules/markers-generator.js?v=1.87.13"></script>
<script src="modules/coa-generator.js"></script> <script src="modules/coa-generator.js"></script>
@ -7882,11 +7882,11 @@
<script src="modules/ui/general.js?v=1.87.03"></script> <script src="modules/ui/general.js?v=1.87.03"></script>
<script src="modules/ui/options.js?v=1.88.02"></script> <script src="modules/ui/options.js?v=1.88.02"></script>
<script src="main.js?v=1.89.05"></script> <script src="main.js?v=1.89.09"></script>
<script defer src="modules/relief-icons.js"></script> <script defer src="modules/relief-icons.js"></script>
<script defer src="modules/ui/style.js"></script> <script defer src="modules/ui/style.js"></script>
<script defer src="modules/ui/editors.js?v=1.90.00"></script> <script defer src="modules/ui/editors.js?v=1.89.09"></script>
<script defer src="modules/ui/tools.js?v=1.89.00"></script> <script defer src="modules/ui/tools.js?v=1.89.00"></script>
<script defer src="modules/ui/world-configurator.js"></script> <script defer src="modules/ui/world-configurator.js"></script>
<script defer src="modules/ui/heightmap-editor.js?v=1.89.06"></script> <script defer src="modules/ui/heightmap-editor.js?v=1.89.06"></script>

View file

@ -695,6 +695,7 @@ async function generate(options) {
if (shouldRegenerateGrid(grid, precreatedSeed)) grid = precreatedGraph || generateGrid(); if (shouldRegenerateGrid(grid, precreatedSeed)) grid = precreatedGraph || generateGrid();
else delete grid.cells.h; else delete grid.cells.h;
grid.cells.h = await HeightmapGenerator.generate(grid); grid.cells.h = await HeightmapGenerator.generate(grid);
pack = {};
markFeatures(); markFeatures();
markupGridOcean(); markupGridOcean();
@ -2038,8 +2039,6 @@ const regenerateMap = debounce(async function (options) {
customization = 0; customization = 0;
resetZoom(1000); resetZoom(1000);
undraw(); undraw();
pack.religions = [];
pack.cultures = [];
await generate(options); await generate(options);
restoreLayers(); restoreLayers();
if (ThreeD.options.isOn) ThreeD.redraw(); if (ThreeD.options.isOn) ThreeD.redraw();

View file

@ -519,11 +519,10 @@ function cultureRegenerateBurgs() {
} }
function removeCulture(cultureId) { function removeCulture(cultureId) {
// and the Folk religion
cults.select("#culture" + cultureId).remove(); cults.select("#culture" + cultureId).remove();
debug.select("#cultureCenter" + cultureId).remove(); debug.select("#cultureCenter" + cultureId).remove();
const {burgs, states, cells, cultures, religions} = pack; const {burgs, states, cells, cultures} = pack;
burgs.filter(b => b.culture == cultureId).forEach(b => (b.culture = 0)); burgs.filter(b => b.culture == cultureId).forEach(b => (b.culture = 0));
states.forEach(s => { states.forEach(s => {
@ -532,11 +531,7 @@ function removeCulture(cultureId) {
cells.culture.forEach((c, i) => { cells.culture.forEach((c, i) => {
if (c === cultureId) cells.culture[i] = 0; if (c === cultureId) cells.culture[i] = 0;
}); });
cells.religion.forEach((r, i) => {
if (r === cultureId) cells.religion[i] = 0;
})
cultures[cultureId].removed = true; cultures[cultureId].removed = true;
religions[cultureId].removed = true;
cultures cultures
.filter(c => c.i && !c.removed) .filter(c => c.i && !c.removed)
@ -544,12 +539,6 @@ function removeCulture(cultureId) {
c.origins = c.origins.filter(origin => origin !== cultureId); c.origins = c.origins.filter(origin => origin !== cultureId);
if (!c.origins.length) c.origins = [0]; 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(); refreshCulturesEditor();
} }
@ -559,7 +548,7 @@ function cultureRemovePrompt() {
const cultureId = +this.parentNode.dataset.id; const cultureId = +this.parentNode.dataset.id;
confirmationDialog({ confirmationDialog({
title: "Remove culture", title: "Remove culture",
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", message: "Are you sure you want to remove the culture? <br>This action cannot be reverted",
confirm: "Remove", confirm: "Remove",
onConfirm: () => removeCulture(cultureId) onConfirm: () => removeCulture(cultureId)
}); });
@ -834,7 +823,6 @@ function addCulture() {
if (d3.event.shiftKey === false) exitAddCultureMode(); if (d3.event.shiftKey === false) exitAddCultureMode();
Cultures.add(center); Cultures.add(center);
Religions.addFolk(center);
drawCultureCenters(); drawCultureCenters();
culturesEditorAddLines(); culturesEditorAddLines();

View file

@ -213,15 +213,9 @@ function religionsEditorAddLines() {
<fill-box fill="${r.color}"></fill-box> <fill-box fill="${r.color}"></fill-box>
<input data-tip="Religion name. Click and type to change" class="religionName" style="width: 11em" <input data-tip="Religion name. Click and type to change" class="religionName" style="width: 11em"
value="${r.name}" autocorrect="off" spellcheck="false" /> value="${r.name}" autocorrect="off" spellcheck="false" />
${r.type === "Folk" ? <select data-tip="Religion type" class="religionType" style="width: 5em">
`<span data-tip="Religion type" class="religionType" style="width: 5em">
Folk
</span>`
:
`<select data-tip="Religion type" class="religionType" style="width: 5em">
${getTypeOptions(r.type)} ${getTypeOptions(r.type)}
</select>` </select>
}
<input data-tip="Religion form" class="religionForm hide" style="width: 6em" <input data-tip="Religion form" class="religionForm hide" style="width: 6em"
value="${r.form}" autocorrect="off" spellcheck="false" /> value="${r.form}" autocorrect="off" spellcheck="false" />
<span data-tip="Click to re-generate supreme deity" class="icon-arrows-cw hide"></span> <span data-tip="Click to re-generate supreme deity" class="icon-arrows-cw hide"></span>
@ -231,37 +225,12 @@ function religionsEditorAddLines() {
<div data-tip="Religion area" class="religionArea hide" style="width: 5em">${si(area) + unit}</div> <div data-tip="Religion area" class="religionArea hide" style="width: 5em">${si(area) + unit}</div>
<span data-tip="${populationTip}" class="icon-male hide"></span> <span data-tip="${populationTip}" class="icon-male hide"></span>
<div data-tip="${populationTip}" class="religionPopulation hide pointer">${si(population)}</div> <div data-tip="${populationTip}" class="religionPopulation hide pointer">${si(population)}</div>
${r.type === "Folk" ? ${getExpansionColumns(r)}
`<span data-tip="Potential religion extent" class="hide" style="width: 5em">
culture
</span>
<span class="icon-resize-full placeholder hide"></span>
<input class="religionExpan placeholder hide" type="number" />
<span <span
data-tip="Lock this religion" data-tip="Lock this religion"
class="icon-lock${r.lock ? "" : "-open"} hide" class="icon-lock${r.lock ? "" : "-open"} hide"
></span> ></span>
<span data-tip="Remove religion" class="icon-trash-empty placeholder hide"></span>` <span data-tip="Remove religion" class="icon-trash-empty hide"></span>
:
`<select data-tip="Potential religion extent" class="religionExtent hide" style="width: 5em">
${getExtentOptions(r.expansion)}
</select>
<span data-tip="Religion expansionism. Defines competitive size" class="icon-resize-full hide"></span>
<input
data-tip="Religion expansionism. Defines competitive size. Click to change, then click Recalculate to apply change"
class="religionExpan hide"
type="number"
min="0"
max="99"
step=".1"
value=${r.expansionism}
/>
<span
data-tip="Lock this religion"
class="icon-lock${r.lock ? "" : "-open"} hide"
></span>
<span data-tip="Remove religion" class="icon-trash-empty hide"></span>`
}
</div>`; </div>`;
} }
$body.innerHTML = lines; $body.innerHTML = lines;
@ -306,11 +275,34 @@ function religionsEditorAddLines() {
function getTypeOptions(type) { function getTypeOptions(type) {
let options = ""; let options = "";
const types = ["Organized", "Cult", "Heresy"]; const types = ["Folk", "Organized", "Cult", "Heresy"];
types.forEach(t => (options += `<option ${type === t ? "selected" : ""} value="${t}">${t}</option>`)); types.forEach(t => (options += `<option ${type === t ? "selected" : ""} value="${t}">${t}</option>`));
return options; return options;
} }
function getExpansionColumns(r) {
if (r.type === "Folk")
return `<span data-tip="Potential religion extent" class="religionExtent hide" style="width: 5em">
culture
</span>
<span class="icon-resize-full placeholder hide"></span>
<input class="religionExpan placeholder hide" type="number" />`
else
return `<select data-tip="Potential religion extent" class="religionExtent hide" style="width: 5em">
${getExtentOptions(r.expansion)}
</select>
<span data-tip="Religion expansionism. Defines competitive size" class="icon-resize-full hide"></span>
<input
data-tip="Religion expansionism. Defines competitive size. Click to change, then click Recalculate to apply change"
class="religionExpan hide"
type="number"
min="0"
max="99"
step=".1"
value=${r.expansionism}
/>`
}
function getExtentOptions(type) { function getExtentOptions(type) {
let options = ""; let options = "";
const types = ["global", "state", "culture"]; const types = ["global", "state", "culture"];

View file

@ -678,7 +678,6 @@ window.Religions = (function () {
const cultureId = cells.culture[cellId]; const cultureId = cells.culture[cellId];
religionIds[cellId] = cultureToReligionMap.get(cultureId) || 0; religionIds[cellId] = cultureToReligionMap.get(cultureId) || 0;
} }
}
return religionIds; return religionIds;
} }

View file

@ -1188,6 +1188,6 @@ async function editCultures() {
async function editReligions() { async function editReligions() {
if (customization) return; if (customization) return;
const Editor = await import("../dynamic/editors/religions-editor.js?v=1.90.00"); const Editor = await import("../dynamic/editors/religions-editor.js?v=1.89.09");
Editor.open(); Editor.open();
} }

View file

@ -1,7 +1,7 @@
"use strict"; "use strict";
// version and caching control // version and caching control
const version = "1.89.08"; // generator version, update each time const version = "1.89.09"; // generator version, update each time
{ {
document.title += " v" + version; document.title += " v" + version;