For Module Developers - KonteiKeisei/kg-cities GitHub Wiki
game.modules.get("kg-cities").api:
| Function | What it does |
|---|---|
cityOf(scene) |
A city scene's { city, era, year, bounds, ... }, or null. |
projector(scene) |
Lat/lon to scene pixels (and back) for any city scene. |
transit(cityId, era) |
A city's rapid transit for an era: track, lines, stations. |
addLandmarks(fn) |
Add landmarks to city maps. fn(cityFlag) returns landmark-like entries (KG Transit's airports use it). |
generateCity(cityId, { era, year, area, at, view }) |
Make a city scene without the dialog. area is "core", "metro" or "auto". |
sceneCovering(cityId, { lat, lon, era }) |
The smallest existing scene of a city whose map covers a point. |
cities() |
The cities the module knows. |
Hook: kgCities.airport is called with { airport, scene } when the GM clicks an airport landmark.
-
npm test(Node 20 or later) runs the tests. -
tools/era-preview.htmldraws a city's era outside Foundry, served bypython tools/serve.py. - The data is built by the tools in
tools/(landmarks, eras, transit) from OpenStreetMap through Nominatim and Overpass. See the notes at the top of each tool. -
node tools/release.mjs <version>builds a clean release indist/.