@@ -174,14 +178,7 @@ function insertHtml() {
Color scheme
-
+
@@ -276,8 +273,7 @@ function drawHeights(heights) {
const ctx = canvas.getContext("2d");
const imageData = ctx.createImageData(graph.cellsX, graph.cellsY);
- const schemeId = byId("heightmapSelectionColorScheme").value;
- const scheme = getColorScheme(schemeId);
+ const scheme = getColorScheme(byId("heightmapSelectionColorScheme").value);
const renderOcean = byId("heightmapSelectionRenderOcean").checked;
const getHeight = height => (height < 20 ? (renderOcean ? height : 0) : height);
diff --git a/modules/ui/layers.js b/modules/ui/layers.js
index 05d1fbc3..09d7a66a 100644
--- a/modules/ui/layers.js
+++ b/modules/ui/layers.js
@@ -297,21 +297,12 @@ function drawHeightmap() {
TIME && console.timeEnd("drawHeightmap");
}
-const colorSchemes = {
- bright: d3.scaleSequential(d3.interpolateSpectral),
- light: d3.scaleSequential(d3.interpolateRdYlGn),
- natural: d3.scaleSequential(d3.interpolateRgbBasis(["white", "#EEEECC", "tan", "green", "teal"])),
- green: d3.scaleSequential(d3.interpolateGreens),
- livid: d3.scaleSequential(d3.interpolateRgbBasis(["#BBBBDD", "#2A3440", "#17343B", "#0A1E24"])),
- monochrome: d3.scaleSequential(d3.interpolateGreys)
-};
-
-function getColorScheme(scheme) {
- if (scheme in colorSchemes) return colorSchemes[scheme];
+function getColorScheme(scheme = "bright") {
+ if (scheme in heightmapColorSchemes) return heightmapColorSchemes[scheme];
throw new Error(`Unsupported color scheme: ${scheme}`);
}
-function getColor(value, scheme = getColorScheme()) {
+function getColor(value, scheme = getColorScheme("bright")) {
return scheme(1 - (value < 20 ? value - 5 : value) / 100);
}
diff --git a/modules/ui/options.js b/modules/ui/options.js
index 403bdef1..88dc380b 100644
--- a/modules/ui/options.js
+++ b/modules/ui/options.js
@@ -702,7 +702,7 @@ function changeEra() {
}
async function openTemplateSelectionDialog() {
- const HeightmapSelectionDialog = await import("../dynamic/heightmap-selection.js?v=1.93.06");
+ const HeightmapSelectionDialog = await import("../dynamic/heightmap-selection.js?v=1.93.07");
HeightmapSelectionDialog.open();
}
diff --git a/modules/ui/style.js b/modules/ui/style.js
index 94331a11..5217d9cb 100644
--- a/modules/ui/style.js
+++ b/modules/ui/style.js
@@ -37,6 +37,20 @@ function editStyle(element, group) {
}, 1500);
}
+const heightmapColorSchemes = {
+ bright: d3.scaleSequential(d3.interpolateSpectral),
+ light: d3.scaleSequential(d3.interpolateRdYlGn),
+ natural: d3.scaleSequential(d3.interpolateRgbBasis(["white", "#EEEECC", "tan", "green", "teal"])),
+ green: d3.scaleSequential(d3.interpolateGreens),
+ livid: d3.scaleSequential(d3.interpolateRgbBasis(["#BBBBDD", "#2A3440", "#17343B", "#0A1E24"])),
+ monochrome: d3.scaleSequential(d3.interpolateGreys)
+};
+
+// add color schemes to the lists
+document.getElementById("styleHeightmapScheme").innerHTML = Object.keys(heightmapColorSchemes)
+ .map(scheme => `
`)
+ .join("");
+
// Toggle style sections on element select
styleElementSelect.addEventListener("change", selectStyleElement);
function selectStyleElement() {
diff --git a/modules/ui/stylePresets.js b/modules/ui/stylePresets.js
index 5b5ad64c..0ba995d4 100644
--- a/modules/ui/stylePresets.js
+++ b/modules/ui/stylePresets.js
@@ -94,6 +94,13 @@ function applyStyle(style) {
if (layerIsOn("toggleTexture") && selector === "#textureImage" && attribute === "src") {
el.setAttribute("href", value);
}
+
+ // add custom heightmap color scheme
+ if (selector === "#terrs" && attribute === "scheme" && !(value in heightmapColorSchemes)) {
+ const colors = value.split(",");
+ heightmapColorSchemes[value] = d3.scaleSequential(d3.interpolateRgbBasis(colors));
+ document.getElementById("styleHeightmapScheme").options.add(new Option(value, value));
+ }
}
}
}
diff --git a/versioning.js b/versioning.js
index 64e3523a..5977d37d 100644
--- a/versioning.js
+++ b/versioning.js
@@ -1,7 +1,7 @@
"use strict";
// version and caching control
-const version = "1.93.06"; // generator version, update each time
+const version = "1.93.07"; // generator version, update each time
{
document.title += " v" + version;
From e019f6c3cddd018b247e67b0f9eb5b198b2a5d31 Mon Sep 17 00:00:00 2001
From: Azgaar
Date: Mon, 6 Nov 2023 00:06:58 +0400
Subject: [PATCH 06/49] hotfix: define color scheme on heightmap edit
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index c7a156c7..e20f95d7 100644
--- a/index.html
+++ b/index.html
@@ -7986,7 +7986,7 @@
-
+
From 42671053d349a09fc33288911e41043183568e67 Mon Sep 17 00:00:00 2001
From: Azgaar
Date: Mon, 6 Nov 2023 00:13:11 +0400
Subject: [PATCH 07/49] fix: add missing religion name variants
---
index.html | 2 +-
modules/religions-generator.js | 13 +++++++------
versioning.js | 2 +-
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/index.html b/index.html
index e20f95d7..8930e303 100644
--- a/index.html
+++ b/index.html
@@ -7977,7 +7977,7 @@
-
+
diff --git a/modules/religions-generator.js b/modules/religions-generator.js
index dcbc141f..88857a01 100644
--- a/modules/religions-generator.js
+++ b/modules/religions-generator.js
@@ -368,11 +368,11 @@ window.Religions = (function () {
Totemism: 1
},
Organized: {
- Polytheism: 14,
- Monotheism: 12,
- Dualism: 6,
- Pantheism: 6,
- "Non-theism": 4
+ Polytheism: 7,
+ Monotheism: 7,
+ Dualism: 3,
+ Pantheism: 2,
+ "Non-theism": 2
},
Cult: {
Cult: 5,
@@ -418,12 +418,13 @@ window.Religions = (function () {
Shamanism: {Beliefs: 3, Shamanism: 2, Druidism: 1, Spirits: 1},
Animism: {Spirits: 3, Beliefs: 1},
Polytheism: {Deities: 3, Faith: 1, Gods: 1, Pantheon: 1},
- "Ancestor worship": {Beliefs: 1, Forefathers: 2, Ancestors: 2},
+ "Ancestor Worship": {Beliefs: 1, Forefathers: 2, Ancestors: 2},
"Nature Worship": {Beliefs: 3, Druids: 1},
Totemism: {Beliefs: 2, Totems: 2, Idols: 1},
Monotheism: {Religion: 2, Church: 3, Faith: 1},
Dualism: {Religion: 3, Faith: 1, Cult: 1},
+ Pantheism: {Religion: 1, Faith: 1},
"Non-theism": {Beliefs: 3, Spirits: 1},
Cult: {Cult: 4, Sect: 2, Arcanum: 1, Order: 1, Worship: 1},
diff --git a/versioning.js b/versioning.js
index 5977d37d..0fe464be 100644
--- a/versioning.js
+++ b/versioning.js
@@ -1,7 +1,7 @@
"use strict";
// version and caching control
-const version = "1.93.07"; // generator version, update each time
+const version = "1.93.08"; // generator version, update each time
{
document.title += " v" + version;
From 98c971b3c4a556b703ce257692f06d5e0c6a5085 Mon Sep 17 00:00:00 2001
From: Azgaar
Date: Tue, 7 Nov 2023 13:49:39 +0400
Subject: [PATCH 08/49] chore: supporters update
---
index.html | 2 +-
modules/dynamic/supporters.js | 8 +++++++-
modules/ui/options.js | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/index.html b/index.html
index 8930e303..88960704 100644
--- a/index.html
+++ b/index.html
@@ -7991,7 +7991,7 @@
-
+
diff --git a/modules/dynamic/supporters.js b/modules/dynamic/supporters.js
index d35ae3b5..f65caf62 100644
--- a/modules/dynamic/supporters.js
+++ b/modules/dynamic/supporters.js
@@ -535,4 +535,10 @@ Rob Frantz
Driver
Tr4v3l3r
Cooper Cantrell
-Maximilien Bouillot`;
+Maximilien Bouillot
+J.E. Ellis
+Igor
+John Todd
+burning.rosary
+Shane Roppel
+Hank Agrippa`;
diff --git a/modules/ui/options.js b/modules/ui/options.js
index 88dc380b..5ba03102 100644
--- a/modules/ui/options.js
+++ b/modules/ui/options.js
@@ -76,7 +76,7 @@ document
// show popup with a list of Patreon supportes (updated manually)
async function showSupporters() {
- const {supporters} = await import("../dynamic/supporters.js?v=1.93.03");
+ const {supporters} = await import("../dynamic/supporters.js?v=1.93.08");
const list = supporters.split("\n").sort();
const columns = window.innerWidth < 800 ? 2 : 5;
From 9332eb7b38b6e700ea602a3ab4362ce789e1f948 Mon Sep 17 00:00:00 2001
From: Azgaar
Date: Sat, 11 Nov 2023 18:02:53 +0400
Subject: [PATCH 09/49] fix: notes to update on deletion
---
index.html | 2 +-
modules/ui/notes-editor.js | 61 +++++++++++++++++++-------------------
versioning.js | 2 +-
3 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/index.html b/index.html
index 88960704..1d85f466 100644
--- a/index.html
+++ b/index.html
@@ -8015,7 +8015,7 @@
-
+
diff --git a/modules/ui/notes-editor.js b/modules/ui/notes-editor.js
index 36b51671..1b55d5b0 100644
--- a/modules/ui/notes-editor.js
+++ b/modules/ui/notes-editor.js
@@ -2,16 +2,14 @@
function editNotes(id, name) {
// elements
- const notesLegend = document.getElementById("notesLegend");
- const notesName = document.getElementById("notesName");
- const notesSelect = document.getElementById("notesSelect");
- const notesPin = document.getElementById("notesPin");
+ const notesLegend = byId("notesLegend");
+ const notesName = byId("notesName");
+ const notesSelect = byId("notesSelect");
+ const notesPin = byId("notesPin");
// update list of objects
notesSelect.options.length = 0;
- for (const note of notes) {
- notesSelect.options.add(new Option(note.id, note.id));
- }
+ notes.forEach(({id}) => notesSelect.options.add(new Option(id, id)));
// update pin notes icon
const notesArePinned = options.pinNotes;
@@ -22,7 +20,7 @@ function editNotes(id, name) {
if (notes.length || id) {
if (!id) id = notes[0].id;
let note = notes.find(note => note.id === id);
- if (note === undefined) {
+ if (!note) {
if (!name) name = id;
note = {id, name, legend: ""};
notes.push(note);
@@ -52,17 +50,17 @@ function editNotes(id, name) {
modules.editNotes = true;
// add listeners
- document.getElementById("notesSelect").addEventListener("change", changeElement);
- document.getElementById("notesName").addEventListener("input", changeName);
- document.getElementById("notesLegend").addEventListener("blur", updateLegend);
- document.getElementById("notesPin").addEventListener("click", toggleNotesPin);
- document.getElementById("notesFocus").addEventListener("click", validateHighlightElement);
- document.getElementById("notesDownload").addEventListener("click", downloadLegends);
- document.getElementById("notesUpload").addEventListener("click", () => legendsToLoad.click());
- document.getElementById("legendsToLoad").addEventListener("change", function () {
+ byId("notesSelect").addEventListener("change", changeElement);
+ byId("notesName").addEventListener("input", changeName);
+ byId("notesLegend").addEventListener("blur", updateLegend);
+ byId("notesPin").addEventListener("click", toggleNotesPin);
+ byId("notesFocus").addEventListener("click", validateHighlightElement);
+ byId("notesDownload").addEventListener("click", downloadLegends);
+ byId("notesUpload").addEventListener("click", () => legendsToLoad.click());
+ byId("legendsToLoad").addEventListener("change", function () {
uploadFile(this, uploadLegends);
});
- document.getElementById("notesRemove").addEventListener("click", triggerNotesRemove);
+ byId("notesRemove").addEventListener("click", triggerNotesRemove);
async function initEditor() {
if (!window.tinymce) {
@@ -108,8 +106,8 @@ function editNotes(id, name) {
}
function updateNotesBox(note) {
- document.getElementById("notesHeader").innerHTML = note.name;
- document.getElementById("notesBody").innerHTML = note.legend;
+ byId("notesHeader").innerHTML = note.name;
+ byId("notesBody").innerHTML = note.legend;
}
function changeElement() {
@@ -131,7 +129,7 @@ function editNotes(id, name) {
}
function validateHighlightElement() {
- const element = document.getElementById(notesSelect.value);
+ const element = byId(notesSelect.value);
if (element) return highlightElement(element, 3);
confirmationDialog({
@@ -157,6 +155,18 @@ function editNotes(id, name) {
}
function triggerNotesRemove() {
+ function removeLegend() {
+ notes = notes.filter(({id}) => id !== notesSelect.value);
+
+ if (!notes.length) {
+ $("#notesEditor").dialog("close");
+ return;
+ }
+
+ removeEditor();
+ editNotes(notes[0].id, notes[0].name);
+ }
+
confirmationDialog({
title: "Remove note",
message: "Are you sure you want to remove the selected note? There is no way to undo this action",
@@ -165,17 +175,6 @@ function editNotes(id, name) {
});
}
- function removeLegend() {
- const index = notes.findIndex(n => n.id === notesSelect.value);
- notes.splice(index, 1);
- notesSelect.options.length = 0;
- if (!notes.length) {
- $("#notesEditor").dialog("close");
- return;
- }
- editNotes(notes[0].id, notes[0].name);
- }
-
function toggleNotesPin() {
options.pinNotes = !options.pinNotes;
this.classList.toggle("pressed");
diff --git a/versioning.js b/versioning.js
index 0fe464be..977f2a89 100644
--- a/versioning.js
+++ b/versioning.js
@@ -1,7 +1,7 @@
"use strict";
// version and caching control
-const version = "1.93.08"; // generator version, update each time
+const version = "1.93.09"; // generator version, update each time
{
document.title += " v" + version;
From 2fd58e9d35d8be25dea89f16ee4d3753e7782dc0 Mon Sep 17 00:00:00 2001
From: Azgaar
Date: Sat, 11 Nov 2023 21:05:59 +0400
Subject: [PATCH 10/49] feat: click on burgs count to open the overview screen
---
index.css | 3 +-
index.html | 42 ++++++++-------
modules/dynamic/editors/states-editor.js | 5 +-
modules/ui/burgs-overview.js | 65 ++++++++++++------------
modules/ui/editors.js | 2 +-
versioning.js | 2 +-
6 files changed, 60 insertions(+), 59 deletions(-)
diff --git a/index.css b/index.css
index b4ec49ce..933434cf 100644
--- a/index.css
+++ b/index.css
@@ -1990,7 +1990,7 @@ input[type="checkbox"] {
.checkbox + .checkbox-label:before {
content: "";
display: inline-block;
- vertical-align: middle;
+ vertical-align: bottom;
width: 0.6em;
height: 0.6em;
padding: 0.2em;
@@ -1998,6 +1998,7 @@ input[type="checkbox"] {
border: 1px solid darkgrey;
border-radius: 15%;
background: white;
+ font-family: var(--monospace);
}
.checkbox:checked + .checkbox-label:before {
diff --git a/index.html b/index.html
index 1d85f466..02018cf7 100644
--- a/index.html
+++ b/index.html
@@ -138,7 +138,7 @@
}
-
+
@@ -4433,9 +4433,9 @@
>
-