v 0.8.28b

This commit is contained in:
Azgaar 2019-06-03 21:23:30 +03:00
parent 54ec78af54
commit d62450b9c1
7 changed files with 101 additions and 56 deletions

View file

@ -22,7 +22,8 @@
if (rnd < .85) input.value = "Archipelago"; else // 30%
if (rnd < .90) input.value = "Mediterranean"; else // 5%
if (rnd < .95) input.value = "Peninsula"; else // 5%
if (rnd < .99) input.value = "Pangea"; else // 4%
if (rnd < .97) input.value = "Pangea"; else // 2%
if (rnd < .99) input.value = "Isthmus"; else // 2%
input.value = "Atoll"; // 1%
}
@ -36,6 +37,7 @@
case "Mediterranean": templateMediterranean(); break;
case "Peninsula": templatePeninsula(); break;
case "Pangea": templatePangea(); break;
case "Isthmus": templateIsthmus(); break;
}
console.timeEnd('generateHeightmap');
@ -175,6 +177,21 @@
addStep("Range", "5-6", "30-40", "10-90", "35-65");
}
// Heighmap Template: Isthmus
function templateIsthmus() {
addStep("Hill", "5-10", "15-30", "0-30", "0-20");
addStep("Hill", "5-10", "15-30", "10-50", "20-40");
addStep("Hill", "5-10", "15-30", "30-70", "40-60");
addStep("Hill", "5-10", "15-30", "50-90", "60-80");
addStep("Hill", "5-10", "15-30", "70-100", "80-100");
addStep("Smooth", 2);
addStep("Trough", "4-8", "15-30", "0-30", "0-20");
addStep("Trough", "4-8", "15-30", "10-50", "20-40");
addStep("Trough", "4-8", "15-30", "30-70", "40-60");
addStep("Trough", "4-8", "15-30", "50-90", "60-80");
addStep("Trough", "4-8", "15-30", "70-100", "80-100");
}
function getBlobPower() {
switch (+densityInput.value) {
case 1: return .98;

View file

@ -121,7 +121,7 @@ function editCultures() {
body.querySelectorAll("div > input.cultureName").forEach(el => el.addEventListener("input", cultureChangeName));
body.querySelectorAll("div > input.statePower").forEach(el => el.addEventListener("input", cultureChangeExpansionism));
body.querySelectorAll("div > select.cultureType").forEach(el => el.addEventListener("change", cultureChangeType));
body.querySelectorAll("div > select.cultureBase").forEach(el => el.addEventListener("click", updateBaseOptions));
body.querySelectorAll("div > select.cultureBase").forEach(el => el.addEventListener("change", cultureChangeBase));
body.querySelectorAll("div > span.icon-arrows-cw").forEach(el => el.addEventListener("click", cultureRegenerateBurgs));
body.querySelectorAll("div > span.icon-trash-empty").forEach(el => el.addEventListener("click", cultureRemove));
@ -185,12 +185,10 @@ function editCultures() {
recalculateCultures();
}
function updateBaseOptions() {
function cultureChangeBase() {
const culture = +this.parentNode.dataset.id;
const v = +this.value;
this.parentNode.dataset.base = pack.cultures[culture].base = v;
this.options.length = 0;
nameBases.forEach((b, i) => this.options.add(new Option(b.name, i, false, i === v)));
this.parentNode.dataset.base = pack.cultures[culture].base = v;
}
function cultureRegenerateBurgs() {

View file

@ -9,7 +9,7 @@ function editHeightmap() {
<p>You can also <i>keep</i> all the data as is, but you won't be able to change the coastline.</p>
<p>If you need to change the coastline and keep the data, you may try the <i>risk</i> edit option.
The secondary data will be kept with burgs placed on water being be removed,
The secondary data will be kept with burgs placed on water being removed,
but the landmass change can cause unexpected data fluctuation and errors.</p>`;
$("#alert").dialog({resizable: false, title: "Edit Heightmap", width: 300,
@ -697,7 +697,21 @@ function editHeightmap() {
addStep("Trough", "3-4", "25-35", "5-95", "80-90");
addStep("Range", "5-6", "30-40", "10-90", "35-65");
}
else if (template === "templateIsthmus") {
addStep("Hill", "5-10", "15-30", "0-30", "0-20");
addStep("Hill", "5-10", "15-30", "10-50", "20-40");
addStep("Hill", "5-10", "15-30", "30-70", "40-60");
addStep("Hill", "5-10", "15-30", "50-90", "60-80");
addStep("Hill", "5-10", "15-30", "70-100", "80-100");
addStep("Smooth", 2);
addStep("Trough", "4-8", "15-30", "0-30", "0-20");
addStep("Trough", "4-8", "15-30", "10-50", "20-40");
addStep("Trough", "4-8", "15-30", "30-70", "40-60");
addStep("Trough", "4-8", "15-30", "50-90", "60-80");
addStep("Trough", "4-8", "15-30", "70-100", "80-100");
}
}
function executeTemplate() {

View file

@ -678,7 +678,7 @@ function toggleTexture() {
// append default texture image selected by default. Don't append on load to not harm performance
if (!texture.selectAll("*").size()) {
const link = getAbsolutePath(styleTextureInput.value);
texture.append("image").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%")
texture.append("image").attr("x", 0).attr("y", 0).attr("width", graphWidth).attr("height", graphHeight)
.attr('xlink:href', link).attr('preserveAspectRatio', "xMidYMid slice");
}
$('#texture').fadeIn();

View file

@ -175,9 +175,15 @@ function selectStyleElement() {
stylePopulationRuralStrokeInput.value = stylePopulationRuralStrokeOutput.value = population.select("#rural").attr("stroke");
stylePopulationUrbanStrokeInput.value = stylePopulationUrbanStrokeOutput.value = population.select("#urban").attr("stroke");
styleStrokeWidth.style.display = "block";
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || "";
styleStrokeWidthInput.value = styleStrokeWidthOutput.value = el.attr("stroke-width") || "";
}
if (sel === "statesBody") {
styleStates.style.display = "block";
styleStatesHaloWidth.value = styleStatesHaloWidthOutput.value = statesHalo.attr("stroke-width");
styleStatesHaloOpacity.value = styleStatesHaloOpacityOutput.value = statesHalo.attr("opacity");
}
if (sel === "labels") {
styleFill.style.display = "block";
styleStroke.style.display = "block";
@ -306,11 +312,11 @@ styleTextureInput.addEventListener("change", function() {
});
styleTextureShiftX.addEventListener("input", function() {
texture.select("image").attr("x", this.value).attr("width", svgWidth - this.valueAsNumber);
texture.select("image").attr("x", this.value).attr("width", graphWidth - this.valueAsNumber);
});
styleTextureShiftY.addEventListener("input", function() {
texture.select("image").attr("y", this.value).attr("height", svgHeight - this.valueAsNumber);
texture.select("image").attr("y", this.value).attr("height", graphHeight - this.valueAsNumber);
});
styleClippingInput.addEventListener("change", function() {
@ -522,6 +528,16 @@ function changeIconSize(size, group) {
styleIconSizeInput.value = size;
}
styleStatesHaloWidth.addEventListener("input", function() {
styleStatesHaloWidthOutput.value = this.value;
statesHalo.attr("stroke-width", +this.value);
});
styleStatesHaloOpacity.addEventListener("input", function() {
styleStatesHaloOpacityOutput.value = this.value;
statesHalo.attr("opacity", +this.value);
});
// request to restore default style on button click
function askToRestoreDefaultStyle() {
alertMessage.innerHTML = "Are you sure you want to restore default style for all elements?";