omokami's
rail cleaning service
hi, i'm omokami. i made a jsMacros bot that helps make de-oxidizing copper blocks on rail systems like, super easy for me. that bot uses player position data over time and axe durability consumption events to draw conclusions about things that happened during my trip. i push all of that data to a cloudflare worker intermittently, which logs it into a database. my website uses this data, and civmap's really awesome api.civ.tools endpoints to show a log of my journey and track overall stats. which is prettttty cool.
shoutout to civmap
civmap is a community-built map of CivMC nations, claims, waypoints, and infrastructure. this site uses civmap's public endpoints only. i couldn't really find any info on who runs it or guidelines for using the API, so i had to figure it out myself. but anything that requires a login (private claims, etc.) is not touched here and my request flow is cache heavy and as polite as i could get it.
caching & politeness
to stay friendly to the civmap infrastructure, every read from
api.civ.tools is heavily cached in the cloudflare worker:
- nation polygons (
/public/claims) are fetched once per day via a scheduled cron, served from KV withETag/304support and 24h browser cache. one request per day, regardless of how many people view this site. - terrain tiles (the colored basemap): fetched on first request, cached at the cloudflare edge for 30 days. once a tile has been viewed once, all subsequent visitors get it from cloudflare's cache.
- my fetches identify me via user-agent
railbuddy/1.0 (+discord:kema, ign:omokami)so the civmap maintainers can contact or block me in case i'm doing something wrong, lmao.
what's logged
per trip: start + end world coordinates and resolved nations, total horizontal distance, total clean events, axes consumed (by type), active vs. idle time, and a polyline of position pings every ~10 seconds during the ride. nothing weird i promise.
source & details
i might release a stripped down version of the bot for other aspirational cleaners, but this was kind of an ugly rush job so no plans to release other parts for now. hope you find this cool.
credits & links
- CivMC: the server everything happens on
- civmap.com +
api.civ.tools: nation polygons + terrain tiles, shoutout above - Copper Rails mod: the mod this whole thing exists to maintain
- JsMacros: the macro framework the in-game script runs on
- Leaflet: interactive map library
- Catppuccin: the Mocha color palette this site uses
- Twemoji: the cute axe in the logo (CC-BY 4.0)
- Cloudflare Workers + D1 + KV: hosting, db, cache