mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.4.13
This commit is contained in:
parent
1488a955b7
commit
6dd1e22e93
6 changed files with 53 additions and 26 deletions
|
|
@ -476,7 +476,6 @@ input[type="color"]::-webkit-color-swatch-wrapper {
|
|||
width: 100%;
|
||||
background-color: white;
|
||||
text-align: left;
|
||||
height: 1.5em;
|
||||
}
|
||||
|
||||
#optionsContent input[type="range"] {
|
||||
|
|
|
|||
18
index.html
18
index.html
|
|
@ -1581,7 +1581,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr data-tip="Click to set up map name to be used for downloaded files">
|
||||
<tr data-tip="Define map name (will be used to name downloaded files)">
|
||||
<td>
|
||||
<i data-locked=0 id="lock_mapName" class="icon-lock-open"></i>
|
||||
</td>
|
||||
|
|
@ -1594,6 +1594,20 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr data-tip="Define current year and era name">
|
||||
<td>
|
||||
<i data-locked=0 id="lock_era" class="icon-lock-open"></i>
|
||||
</td>
|
||||
<td>Year and era</td>
|
||||
<td>
|
||||
<input id="yearInput" data-stored="year" type="number" step=1 class="paired" style="width: 24%; float: left; font-size: smaller">
|
||||
<input id="eraInput" data-stored="era" autocorrect="off" spellcheck="false" type="text" style="width: 75%; float: right" class="long">
|
||||
</td>
|
||||
<td>
|
||||
<i id="optionsEraRegenerate" data-tip="Regenerate era" class="icon-arrows-cw"></i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr data-tip="Select template to be used for a Heightmap generation">
|
||||
<td>
|
||||
<i data-locked=0 id="lock_template" class="icon-lock-open"></i>
|
||||
|
|
@ -1685,7 +1699,7 @@
|
|||
<input id="powerInput" data-stored="power" type="range" min=0 max=10 step=.2 value=5>
|
||||
</td>
|
||||
<td>
|
||||
<input id="powerOutput" data-stored="power" type="number" min=0 max=10 step=.2 value=5>
|
||||
<input id="powerOutput" data-stored="power" type="number" min=0 max=10 step=.1 value=5>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
|||
11
main.js
11
main.js
|
|
@ -102,7 +102,7 @@ legend.on("mousemove", () => tip("Drag to change the position. Click to hide the
|
|||
// main data variables
|
||||
let grid = {}; // initial grapg based on jittered square grid and data
|
||||
let pack = {}; // packed graph and data
|
||||
let seed, mapHistory = [], elSelected, modules = {}, notes = [];
|
||||
let seed, mapId, mapHistory = [], elSelected, modules = {}, notes = [];
|
||||
let customization = 0; // 0 - no; 1 = heightmap draw; 2 - states draw; 3 - add state/burg; 4 - cultures draw
|
||||
|
||||
let biomesData = applyDefaultBiomesSystem();
|
||||
|
|
@ -121,11 +121,6 @@ let options = {}; // options object
|
|||
let mapCoordinates = {}; // map coordinates on globe
|
||||
options.winds = [225, 45, 225, 315, 135, 315]; // default wind directions
|
||||
|
||||
// woldbuilding options
|
||||
options.year = rand(100, 2000); // current year
|
||||
options.era = Names.getBaseShort(P(.7) ? 1 : rand(nameBases.length)) + " Era"; // current era name, global for all cultures
|
||||
options.eraShort = options.era[0] + "E"; // short name for era
|
||||
|
||||
applyStoredOptions();
|
||||
let graphWidth = +mapWidthInput.value, graphHeight = +mapHeightInput.value; // voronoi graph extention, cannot be changed arter generation
|
||||
let svgWidth = graphWidth, svgHeight = graphHeight; // svg canvas resolution, can be changed
|
||||
|
|
@ -1710,7 +1705,9 @@ function showStatistics() {
|
|||
Religions: ${pack.religions.length-1}
|
||||
Culture set: ${culturesSet.selectedOptions[0].innerText}
|
||||
Cultures: ${pack.cultures.length-1}`;
|
||||
mapHistory.push({seed, width:graphWidth, height:graphHeight, template, created: Date.now()});
|
||||
|
||||
mapId = Date.now(); // unique map id is it's creation date number
|
||||
mapHistory.push({seed, width:graphWidth, height:graphHeight, template, created:mapId});
|
||||
console.log(stats);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ function getMapData() {
|
|||
const date = new Date();
|
||||
const dateString = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
|
||||
const license = "File can be loaded in azgaar.github.io/Fantasy-Map-Generator";
|
||||
const params = [version, license, dateString, seed, graphWidth, graphHeight].join("|");
|
||||
const params = [version, license, dateString, seed, graphWidth, graphHeight, mapId].join("|");
|
||||
const settings = [distanceUnitInput.value, distanceScaleInput.value, areaUnit.value,
|
||||
heightUnit.value, heightExponentInput.value, temperatureScale.value,
|
||||
barSize.value, barLabel.value, barBackOpacity.value, barBackColor.value,
|
||||
|
|
@ -586,6 +586,7 @@ function parseLoadedData(data) {
|
|||
if (params[3]) {seed = params[3]; optionsSeed.value = seed;}
|
||||
if (params[4]) graphWidth = +params[4];
|
||||
if (params[5]) graphHeight = +params[5];
|
||||
mapId = params[6] ? +params[6] : Date.now();
|
||||
}()
|
||||
|
||||
console.group("Loaded Map " + seed);
|
||||
|
|
|
|||
|
|
@ -339,10 +339,7 @@ class Battle {
|
|||
|
||||
cancelResults() {
|
||||
// move regiments back to initial positions
|
||||
this.attackers.regiments.concat(this.defenders.regiments).forEach(r => {
|
||||
Military.moveRegiment(r, r.px, r.py);
|
||||
});
|
||||
|
||||
this.attackers.regiments.concat(this.defenders.regiments).forEach(r => Military.moveRegiment(r, r.px, r.py));
|
||||
$("#battleScreen").dialog("close");
|
||||
this.cleanData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ optionsContent.addEventListener("click", function(event) {
|
|||
else if (id === "optionsSeedGenerate") generateMapWithSeed();
|
||||
else if (id === "optionsMapHistory") showSeedHistoryDialog();
|
||||
else if (id === "optionsCopySeed") copyMapURL();
|
||||
else if (id === "optionsEraRegenerate") regenerateEra();
|
||||
else if (id === "zoomExtentDefault") restoreDefaultZoomExtent();
|
||||
else if (id === "translateExtent") toggleTranslateExtent(event.target);
|
||||
});
|
||||
|
|
@ -354,6 +355,9 @@ function randomizeOptions() {
|
|||
if (!stored("distanceUnit")) distanceUnitInput.value = US || UK ? "mi" : "km";
|
||||
if (!stored("heightUnit")) heightUnit.value = US || UK ? "ft" : "m";
|
||||
if (!stored("temperatureScale")) temperatureScale.value = US ? "°F" : "°C";
|
||||
|
||||
// World settings
|
||||
generateEra();
|
||||
}
|
||||
|
||||
// select heightmap template pseudo-randomly
|
||||
|
|
@ -389,6 +393,21 @@ function randomizeCultureSet() {
|
|||
changeCultureSet();
|
||||
}
|
||||
|
||||
// generate current year and era name
|
||||
function generateEra() {
|
||||
if (!stored("year")) yearInput.value = rand(100, 2000); // current year
|
||||
if (!stored("era")) eraInput.value = Names.getBaseShort(P(.7) ? 1 : rand(nameBases.length)) + " Era";
|
||||
options.year = yearInput.value;
|
||||
options.era = eraInput.value;
|
||||
options.eraShort = options.era.split(" ").map(w => w[0].toUpperCase()).join(""); // short name for era
|
||||
}
|
||||
|
||||
function regenerateEra() {
|
||||
unlock("era");
|
||||
options.era = eraInput.value = Names.getBaseShort(P(.7) ? 1 : rand(nameBases.length)) + " Era";
|
||||
options.eraShort = options.era.split(" ").map(w => w[0].toUpperCase()).join("");
|
||||
}
|
||||
|
||||
// remove all saved data from LocalStorage and reload the page
|
||||
function restoreDefaultOptions() {
|
||||
localStorage.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue