five-on-it / packages/catalogue/src/region/heights
packages/catalogue/src/region/heights
The levels of a region's corners, solved from its spec: what its features wish for, then made consistent. Each feature raises (a hill, a mountain, a plateau, a volcano and its rim, a lake's shore) or lowers (a valley, a lake's bed, a volcano's crater) the corners it covers, and a town's terraced district holds its corners at its level; the raise spreads outward a level per tile (two round a mountain) so a peak gets its sides; the rim and the spawn apron are pinned at level 0 and a valley at its floor, and lowering from them spreads the same way. Inside a town the step is one level, two only under a hill or valley marked steep (never on its outermost tiles nor where an avenue runs). What comes out never has two neighbouring corners further apart than their step allows, so every tile is one of the shapes of tiles.json and two tiles meeting at an edge agree on it. A feature cut short (its peak too close to the rim, a plateau on a slope), a town where it may not stand, a terrace the land cannot reach, is reported, its path in the spec.