mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
something
This commit is contained in:
parent
ab08dc9429
commit
c86bb5732e
5 changed files with 69 additions and 20 deletions
|
|
@ -198,17 +198,22 @@ window.BurgsAndStates = (() => {
|
|||
else b.y = rn(b.y - shift, 2);
|
||||
}
|
||||
|
||||
// define emblem
|
||||
const state = pack.states[b.state];
|
||||
const stateCOA = state.coa;
|
||||
let kinship = 0.25;
|
||||
if (b.capital) kinship += 0.1;
|
||||
else if (b.port) kinship -= 0.1;
|
||||
if (b.culture !== state.culture) kinship -= 0.25;
|
||||
b.type = getType(i, b.port);
|
||||
const type = b.capital && P(0.2) ? "Capital" : b.type === "Generic" ? "City" : b.type;
|
||||
b.coa = COA.generate(stateCOA, kinship, null, type);
|
||||
b.coa.shield = COA.getShield(b.culture, b.state);
|
||||
// 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
|
||||
const state = pack.states[b.state];
|
||||
const stateCOA = state.coa;
|
||||
let kinship = 0.25;
|
||||
if (b.capital) kinship += 0.1;
|
||||
else if (b.port) kinship -= 0.1;
|
||||
if (b.culture !== state.culture) kinship -= 0.25;
|
||||
b.type = getType(i, b.port);
|
||||
const type = b.capital && P(0.2) ? "Capital" : b.type === "Generic" ? "City" : b.type;
|
||||
b.coa = COA.generate(stateCOA, kinship, null, type);
|
||||
b.coa.shield = COA.getShield(b.culture, b.state);
|
||||
}
|
||||
|
||||
// de-assign port status if it's the only one on feature
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
window.Markers = (function () {
|
||||
|
|
@ -154,10 +177,20 @@ window.Markers = (function () {
|
|||
if (marker.cell === undefined) return;
|
||||
const i = last(pack.markers)?.i + 1 || 0;
|
||||
const [x, y] = getMarkerCoordinates(marker.cell);
|
||||
marker = {...base, x, y, ...marker, i};
|
||||
pack.markers.push(marker);
|
||||
occupied[marker.cell] = true;
|
||||
return marker;
|
||||
// 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);
|
||||
occupied[marker.cell] = true;
|
||||
return marker;
|
||||
}
|
||||
|
||||
function deleteMarker(markerId) {
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
|||
}
|
||||
|
||||
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
|
||||
|
||||
valid.forEach(b => {
|
||||
|
|
@ -506,6 +506,11 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
|||
data += convertTemperature(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
|
||||
data += b.capital ? "capital," : ",";
|
||||
data += b.port ? "port," : ",";
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ function overviewMarkers() {
|
|||
|
||||
function addLines() {
|
||||
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 */ `
|
||||
<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>`
|
||||
}
|
||||
<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="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 ${
|
||||
|
|
@ -209,11 +213,11 @@ function overviewMarkers() {
|
|||
}
|
||||
|
||||
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 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 name = note ? quote(note.name) : "Unknown";
|
||||
|
|
@ -221,8 +225,10 @@ function overviewMarkers() {
|
|||
|
||||
const lat = getLatitude(y, 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");
|
||||
|
|
|
|||
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