mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
markers - statues
This commit is contained in:
parent
98bed4c091
commit
c12507e336
2 changed files with 39 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ window.Markers = (function () {
|
||||||
addSacredPalmGroves();
|
addSacredPalmGroves();
|
||||||
addBrigands();
|
addBrigands();
|
||||||
addPirates();
|
addPirates();
|
||||||
|
addStatues();
|
||||||
|
|
||||||
TIME && console.timeEnd("addMarkers");
|
TIME && console.timeEnd("addMarkers");
|
||||||
};
|
};
|
||||||
|
|
@ -413,6 +414,43 @@ window.Markers = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addStatues() {
|
||||||
|
const {cells} = pack;
|
||||||
|
let statues = Array.from(cells.i.filter(i => cells.h[i] >= 20 && cells.h[i] < 40));
|
||||||
|
let quantity = getQuantity(statues, 80, 1200);
|
||||||
|
if (!quantity) return;
|
||||||
|
addMarker("statues", "🗿", 50, 50, 12);
|
||||||
|
|
||||||
|
const types = ["Statue", "Obelisk", "Monument", "Column", "Monolith", "Pillar", "Megalith", "Stele", "Runestone"];
|
||||||
|
const scripts = {
|
||||||
|
cypriot: "𐠁𐠂𐠃𐠄𐠅𐠈𐠊𐠋𐠌𐠍𐠎𐠏𐠐𐠑𐠒𐠓𐠔𐠕𐠖𐠗𐠘𐠙𐠚𐠛𐠜𐠝𐠞𐠟𐠠𐠡𐠢𐠣𐠤𐠥𐠦𐠧𐠨𐠩𐠪𐠫𐠬𐠭𐠮𐠯𐠰𐠱𐠲𐠳𐠴𐠵𐠷𐠸𐠼𐠿 ",
|
||||||
|
geez: "ሀለሐመሠረሰቀበተኀነአከወዐዘየደገጠጰጸፀፈፐ ",
|
||||||
|
coptic: "ⲲⲴⲶⲸⲺⲼⲾⳀⳁⳂⳃⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳤ⳥⳧⳩⳪ⳫⳬⳭⳲ⳹⳾ ",
|
||||||
|
tibetan: "ༀ༁༂༃༄༅༆༇༈༉༊་༌༐༑༒༓༔༕༖༗༘༙༚༛༜༠༡༢༣༤༥༦༧༨༩༪༫༬༭༮༯༰༱༲༳༴༵༶༷༸༹༺༻༼༽༾༿",
|
||||||
|
mongolian: "᠀᠐᠑᠒ᠠᠡᠦᠧᠨᠩᠪᠭᠮᠯᠰᠱᠲᠳᠵᠻᠼᠽᠾᠿᡀᡁᡆᡍᡎᡏᡐᡑᡒᡓᡔᡕᡖᡗᡙᡜᡝᡞᡟᡠᡡᡭᡮᡯᡰᡱᡲᡳᡴᢀᢁᢂᢋᢏᢐᢑᢒᢓᢛᢜᢞᢟᢠᢡᢢᢤᢥᢦ"
|
||||||
|
};
|
||||||
|
|
||||||
|
while (quantity) {
|
||||||
|
const [cell] = extractAnyElement(statues);
|
||||||
|
const id = appendMarker(cell, "statues");
|
||||||
|
const culture = cells.culture[cell];
|
||||||
|
|
||||||
|
const type = ra(types);
|
||||||
|
const name = `${Names.getCulture(culture)} ${type}`;
|
||||||
|
const script = scripts[ra(Object.keys(scripts))];
|
||||||
|
const inscription = Array(rand(40, 100))
|
||||||
|
.fill(null)
|
||||||
|
.map(() => ra(script))
|
||||||
|
.join("");
|
||||||
|
const legend = `An ancient ${type.toLowerCase()}. It has an inscription, but no one can translate it:
|
||||||
|
<div style="font-size: 1.8em; line-break: anywhere;">${inscription}</div>`;
|
||||||
|
notes.push({id, name, legend});
|
||||||
|
quantity--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// pyramid"
|
||||||
|
|
||||||
function addMarker(id, icon, x, y, size) {
|
function addMarker(id, icon, x, y, size) {
|
||||||
const markers = svg.select("#defs-markers");
|
const markers = svg.select("#defs-markers");
|
||||||
if (markers.select("#marker_" + id).size()) return;
|
if (markers.select("#marker_" + id).size()) return;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ function handleKeyup(event) {
|
||||||
const {tagName, contentEditable} = document.activeElement;
|
const {tagName, contentEditable} = document.activeElement;
|
||||||
if (["INPUT", "SELECT", "TEXTAREA"].includes(tagName)) return; // don't trigger if user inputs text
|
if (["INPUT", "SELECT", "TEXTAREA"].includes(tagName)) return; // don't trigger if user inputs text
|
||||||
if (tagName === "DIV" && contentEditable === "true") return; // don't trigger if user inputs a text
|
if (tagName === "DIV" && contentEditable === "true") return; // don't trigger if user inputs a text
|
||||||
|
if (document.getSelection().toString()) return; // don't trigger if user selects text
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
const {ctrlKey, metaKey, shiftKey, altKey} = event;
|
const {ctrlKey, metaKey, shiftKey, altKey} = event;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue