mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-19 10:31:24 +01:00
feat(markers): add province information to markers, v1.108.14
- Attach province ID to markers when created (markers-generator.js) - Add migration function to populate province data for old maps (load.js) - Clean up code formatting and remove user-specific Obsidian paths - Update version to 1.108.14 - Update file hashes in index.html
This commit is contained in:
parent
9812da115a
commit
e21999a736
4 changed files with 15 additions and 17 deletions
|
|
@ -716,6 +716,9 @@ async function parseLoadedData(data, mapVersion) {
|
|||
// sort markers by index
|
||||
pack.markers.sort((a, b) => a.i - b.i);
|
||||
}
|
||||
|
||||
// assign biome and province info to markers for old maps or maps without this data
|
||||
if (typeof assignBiomeAndProvinceInfo !== "undefined") assignBiomeAndProvinceInfo();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -177,20 +177,15 @@ window.Markers = (function () {
|
|||
if (marker.cell === undefined) return;
|
||||
const i = last(pack.markers)?.i + 1 || 0;
|
||||
const [x, y] = getMarkerCoordinates(marker.cell);
|
||||
// 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;
|
||||
|
||||
// Attach biome and province info
|
||||
const biome = pack.cells.biome[marker.cell];
|
||||
const province = pack.cells.province ? pack.cells.province[marker.cell] : undefined;
|
||||
|
||||
marker = {...base, x, y, ...marker, i, biome, province};
|
||||
pack.markers.push(marker);
|
||||
occupied[marker.cell] = true;
|
||||
return marker;
|
||||
}
|
||||
|
||||
function deleteMarker(markerId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue