mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
something
This commit is contained in:
parent
ab08dc9429
commit
c86bb5732e
5 changed files with 69 additions and 20 deletions
|
|
@ -198,6 +198,11 @@ window.BurgsAndStates = (() => {
|
||||||
else b.y = rn(b.y - shift, 2);
|
else b.y = rn(b.y - shift, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach biome info
|
||||||
|
b.biome = pack.cells.biome[i];
|
||||||
|
// Attach province info if available
|
||||||
|
b.province = pack.cells.province ? pack.cells.province[i] : undefined;
|
||||||
|
|
||||||
// define emblem
|
// define emblem
|
||||||
const state = pack.states[b.state];
|
const state = pack.states[b.state];
|
||||||
const stateCOA = state.coa;
|
const stateCOA = state.coa;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,26 @@
|
||||||
|
// Assign biome and province info to existing markers, burgs, and provinces after loading a map
|
||||||
|
window.assignBiomeAndProvinceInfo = function() {
|
||||||
|
// Markers
|
||||||
|
if (pack.markers && pack.cells && pack.cells.biome) {
|
||||||
|
pack.markers.forEach(marker => {
|
||||||
|
if (marker.cell !== undefined) {
|
||||||
|
marker.biome = pack.cells.biome[marker.cell];
|
||||||
|
marker.province = pack.cells.province ? pack.cells.province[marker.cell] : undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Burgs
|
||||||
|
if (pack.burgs && pack.cells && pack.cells.biome) {
|
||||||
|
pack.burgs.forEach(burg => {
|
||||||
|
if (burg.cell !== undefined) {
|
||||||
|
burg.biome = pack.cells.biome[burg.cell];
|
||||||
|
burg.province = pack.cells.province ? pack.cells.province[burg.cell] : undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Provinces (if you want to attach biome info, though provinces are usually collections of cells)
|
||||||
|
// You could aggregate biomes for each province if needed
|
||||||
|
};
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
window.Markers = (function () {
|
window.Markers = (function () {
|
||||||
|
|
@ -154,7 +177,17 @@ window.Markers = (function () {
|
||||||
if (marker.cell === undefined) return;
|
if (marker.cell === undefined) return;
|
||||||
const i = last(pack.markers)?.i + 1 || 0;
|
const i = last(pack.markers)?.i + 1 || 0;
|
||||||
const [x, y] = getMarkerCoordinates(marker.cell);
|
const [x, y] = getMarkerCoordinates(marker.cell);
|
||||||
marker = {...base, x, y, ...marker, i};
|
// Attach biome and province info
|
||||||
|
const biome = pack.cells.biome[marker.cell];
|
||||||
|
const province = pack.cells.province ? pack.cells.province[marker.cell] : undefined;
|
||||||
|
// Add Obsidian note path (customize as needed)
|
||||||
|
const obsidianNotePath = `Neblub/Orbis/Markers/${marker.type}-${marker.cell}`;
|
||||||
|
marker = {...base, x, y, ...marker, i, biome, province, obsidianNotePath};
|
||||||
|
// Utility to open Obsidian note for a marker
|
||||||
|
window.openObsidianNote = function(notePath) {
|
||||||
|
const uri = `obsidian://open?vault=Neblub&file=${encodeURIComponent(notePath)}`;
|
||||||
|
window.open(uri, '_blank');
|
||||||
|
};
|
||||||
pack.markers.push(marker);
|
pack.markers.push(marker);
|
||||||
occupied[marker.cell] = true;
|
occupied[marker.cell] = true;
|
||||||
return marker;
|
return marker;
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,7 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadBurgsData() {
|
function downloadBurgsData() {
|
||||||
let data = `Id,Burg,Province,Province Full Name,State,State Full Name,Culture,Religion,Population,X,Y,Latitude,Longitude,Elevation (${heightUnit.value}),Temperature,Temperature likeness,Capital,Port,Citadel,Walls,Plaza,Temple,Shanty Town,Emblem,City Generator Link\n`; // headers
|
let data = `Id,Burg,Province,Province Full Name,State,State Full Name,Culture,Religion,Population,X,Y,Latitude,Longitude,Elevation (${heightUnit.value}),Temperature,Temperature likeness,Biome,Province Id,Capital,Port,Citadel,Walls,Plaza,Temple,Shanty Town,Emblem,City Generator Link\n`; // headers
|
||||||
const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs
|
const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs
|
||||||
|
|
||||||
valid.forEach(b => {
|
valid.forEach(b => {
|
||||||
|
|
@ -506,6 +506,11 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
||||||
data += convertTemperature(temperature) + ",";
|
data += convertTemperature(temperature) + ",";
|
||||||
data += getTemperatureLikeness(temperature) + ",";
|
data += getTemperatureLikeness(temperature) + ",";
|
||||||
|
|
||||||
|
// add biome and province id
|
||||||
|
const biomeName = b.biome !== undefined ? window.Biomes.getDefault().name[b.biome] : "";
|
||||||
|
data += biomeName + ",";
|
||||||
|
data += b.province !== undefined ? b.province + "," : ",";
|
||||||
|
|
||||||
// add status data
|
// add status data
|
||||||
data += b.capital ? "capital," : ",";
|
data += b.capital ? "capital," : ",";
|
||||||
data += b.port ? "port," : ",";
|
data += b.port ? "port," : ",";
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,9 @@ function overviewMarkers() {
|
||||||
|
|
||||||
function addLines() {
|
function addLines() {
|
||||||
const lines = pack.markers
|
const lines = pack.markers
|
||||||
.map(({i, type, icon, pinned, lock}) => {
|
.map(({i, type, icon, pinned, lock, biome, province}) => {
|
||||||
|
const biomeName = biome !== undefined ? window.Biomes.getDefault().name[biome] : "";
|
||||||
|
const provinceName = province !== undefined && pack.provinces[province] ? pack.provinces[province].name : "";
|
||||||
return /* html */ `
|
return /* html */ `
|
||||||
<div class="states" data-i=${i} data-type="${type}">
|
<div class="states" data-i=${i} data-type="${type}">
|
||||||
${
|
${
|
||||||
|
|
@ -77,6 +79,8 @@ function overviewMarkers() {
|
||||||
: `<span data-tip="Marker icon" style="width:1.2em">${icon}</span>`
|
: `<span data-tip="Marker icon" style="width:1.2em">${icon}</span>`
|
||||||
}
|
}
|
||||||
<div data-tip="Marker type" style="width:10em">${type}</div>
|
<div data-tip="Marker type" style="width:10em">${type}</div>
|
||||||
|
<div data-tip="Biome" style="width:10em">${biomeName}</div>
|
||||||
|
<div data-tip="Province" style="width:10em">${provinceName}</div>
|
||||||
<span style="padding-right:.1em" data-tip="Edit marker" class="icon-pencil"></span>
|
<span style="padding-right:.1em" data-tip="Edit marker" class="icon-pencil"></span>
|
||||||
<span style="padding-right:.1em" data-tip="Focus on marker position" class="icon-dot-circled pointer"></span>
|
<span style="padding-right:.1em" data-tip="Focus on marker position" class="icon-dot-circled pointer"></span>
|
||||||
<span style="padding-right:.1em" data-tip="Pin marker (display only pinned markers)" class="icon-pin ${
|
<span style="padding-right:.1em" data-tip="Pin marker (display only pinned markers)" class="icon-pin ${
|
||||||
|
|
@ -209,11 +213,11 @@ function overviewMarkers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportMarkers() {
|
function exportMarkers() {
|
||||||
const headers = "Id,Type,Icon,Name,Note,X,Y,Latitude,Longitude\n";
|
const headers = "Id,Type,Icon,Name,Note,X,Y,Latitude,Longitude,Biome,Province\n";
|
||||||
const quote = s => '"' + s.replaceAll('"', '""') + '"';
|
const quote = s => '"' + s.replaceAll('"', '""') + '"';
|
||||||
|
|
||||||
const body = pack.markers.map(marker => {
|
const body = pack.markers.map(marker => {
|
||||||
const {i, type, icon, x, y} = marker;
|
const {i, type, icon, x, y, biome, province} = marker;
|
||||||
|
|
||||||
const note = notes.find(note => note.id === "marker" + i);
|
const note = notes.find(note => note.id === "marker" + i);
|
||||||
const name = note ? quote(note.name) : "Unknown";
|
const name = note ? quote(note.name) : "Unknown";
|
||||||
|
|
@ -221,8 +225,10 @@ function overviewMarkers() {
|
||||||
|
|
||||||
const lat = getLatitude(y, 2);
|
const lat = getLatitude(y, 2);
|
||||||
const lon = getLongitude(x, 2);
|
const lon = getLongitude(x, 2);
|
||||||
|
const biomeName = biome !== undefined ? window.Biomes.getDefault().name[biome] : "";
|
||||||
|
const provinceName = province !== undefined && pack.provinces[province] ? pack.provinces[province].name : "";
|
||||||
|
|
||||||
return [i, type, icon, name, legend, x, y, lat, lon].join(",");
|
return [i, type, icon, name, legend, x, y, lat, lon, biomeName, provinceName].join(",");
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = headers + body.join("\n");
|
const data = headers + body.join("\n");
|
||||||
|
|
|
||||||
0
run_python_server.sh
Normal file → Executable file
0
run_python_server.sh
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue