mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
Added support for custom map links in Burgs
+ Added field under "Burg Features" + Added property "link" to burg objects with handling for undefined + Added support for "Generate", "Generated", "Default", and "" to behave as the current MFCG behavior while anything else is treated as a custom link + Added tips for the new field
This commit is contained in:
parent
168cb3cdab
commit
41b998af0a
2 changed files with 37 additions and 16 deletions
|
|
@ -984,6 +984,8 @@
|
||||||
<div id="burgFeaturesSection" style="display: none">
|
<div id="burgFeaturesSection" style="display: none">
|
||||||
<button id="burgToggleCapital" onmouseover="tip('Mark the Burg as country capital. Neutral burg cannot be a capital')" class="icon-star"></button>
|
<button id="burgToggleCapital" onmouseover="tip('Mark the Burg as country capital. Neutral burg cannot be a capital')" class="icon-star"></button>
|
||||||
<button id="burgTogglePort" onmouseover="tip('Mark the Burg as port (toggle anchor icon)')" class="icon-anchor"></button>
|
<button id="burgTogglePort" onmouseover="tip('Mark the Burg as port (toggle anchor icon)')" class="icon-anchor"></button>
|
||||||
|
<i onmouseover="tip('Set Burg custom map link')" class="icon-link"></i>
|
||||||
|
<input id="burgLink" onmouseover="tip('Set Burg custom map link or specify Generated to use the default')" type="text" style="width: 200px;" />
|
||||||
<i onmouseover="tip('Set Burg population')" class="icon-users"></i>
|
<i onmouseover="tip('Set Burg population')" class="icon-users"></i>
|
||||||
<input id="burgPopulation" onmouseover="tip('Set Burg population (in population points)')" type="number" value="1" min="0" step="1" style="width: 40px;"></select>
|
<input id="burgPopulation" onmouseover="tip('Set Burg population (in population points)')" type="number" value="1" min="0" step="1" style="width: 40px;"></select>
|
||||||
<output id="burgPopulationFriendly" onmouseover="tip('Burg population (in people)')">1000</output>
|
<output id="burgPopulationFriendly" onmouseover="tip('Burg population (in people)')">1000</output>
|
||||||
|
|
|
||||||
21
script.js
21
script.js
|
|
@ -3628,6 +3628,7 @@ function fantasyMap() {
|
||||||
}
|
}
|
||||||
d3.select("#burgTogglePort").classed("pressed", cell.port !== undefined);
|
d3.select("#burgTogglePort").classed("pressed", cell.port !== undefined);
|
||||||
burgPopulation.value = manors[id].population;
|
burgPopulation.value = manors[id].population;
|
||||||
|
burgMFCGLink.value = manors[id].link || "Generate";
|
||||||
burgPopulationFriendly.value = rn(manors[id].population * urbanization.value * populationRate.value * 1000);
|
burgPopulationFriendly.value = rn(manors[id].population * urbanization.value * populationRate.value * 1000);
|
||||||
|
|
||||||
$("#burgEditor").dialog({
|
$("#burgEditor").dialog({
|
||||||
|
|
@ -3914,6 +3915,11 @@ function fantasyMap() {
|
||||||
manors[id].population = +this.value;
|
manors[id].population = +this.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#burgMFCGLink").on("input", function() {
|
||||||
|
const id = +elSelected.attr("data-id");
|
||||||
|
manors[id].link = this.value;
|
||||||
|
});
|
||||||
|
|
||||||
$("#burgRelocate").click(function() {
|
$("#burgRelocate").click(function() {
|
||||||
if ($(this).hasClass('pressed')) {
|
if ($(this).hasClass('pressed')) {
|
||||||
$(".pressed").removeClass('pressed');
|
$(".pressed").removeClass('pressed');
|
||||||
|
|
@ -3993,6 +3999,13 @@ function fantasyMap() {
|
||||||
|
|
||||||
// open in MFCG
|
// open in MFCG
|
||||||
$("#burgSeeInMFCG").click(function() {
|
$("#burgSeeInMFCG").click(function() {
|
||||||
|
var win;
|
||||||
|
switch(burgLink.value.toLowerCase()) {
|
||||||
|
case("default"):
|
||||||
|
case("generate"):
|
||||||
|
case("generated"):
|
||||||
|
case("undefined"):
|
||||||
|
case(""):
|
||||||
const id = +elSelected.attr("data-id");
|
const id = +elSelected.attr("data-id");
|
||||||
const name = manors[id].name;
|
const name = manors[id].name;
|
||||||
const cell = manors[id].cell;
|
const cell = manors[id].cell;
|
||||||
|
|
@ -4007,8 +4020,14 @@ function fantasyMap() {
|
||||||
const url = "http://fantasycities.watabou.ru/";
|
const url = "http://fantasycities.watabou.ru/";
|
||||||
let params = `?name=${name}&size=${size}&seed=${s}&hub=${hub}&random=0&continuous=0`;
|
let params = `?name=${name}&size=${size}&seed=${s}&hub=${hub}&random=0&continuous=0`;
|
||||||
params += `&river=${river}&coast=${coast}&citadel=${id&1}&plaza=${sec}&temple=${thr}&walls=${sec}&shantytown=${sec}`;
|
params += `&river=${river}&coast=${coast}&citadel=${id&1}&plaza=${sec}&temple=${thr}&walls=${sec}&shantytown=${sec}`;
|
||||||
const win = window.open(url+params, '_blank');
|
win = window.open(url+params, '_blank');
|
||||||
win.focus();
|
win.focus();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
win = window.open(burgLink.value, '_blank');
|
||||||
|
win.focus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#burgAddfromEditor").click(function() {
|
$("#burgAddfromEditor").click(function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue