Add slope/neighbour-gradient query to TerrainGrid #27

Closed
opened 2026-08-19 06:35:46 +01:00 by liamjd · 0 comments
Owner

docs/resource-prospecting.md says stone should be "richest against the side of a hill," and follow-up discussion settled that on the Quarry facility rather than a resource deposit: stone is extractable everywhere, but a Quarry may only be placed against sloped terrain (binary pass/fail, no yield gradient — deliberately dropping the "richest" framing from the doc). See #26 for the rest of that decision.

The gap

TerrainGrid (scripts/terrain_grid.gd) has no query that answers "is this tile against a slope." It tracks per-tile level_at(cell) and has neighbour-level-difference logic already, but only privately, inside _can_traverse()'s cliff check for pathfinding — not exposed as a general-purpose terrain query.

Scope

  • Add a public query (e.g. is_sloped(cell: Vector2i) -> bool) that checks whether any neighbouring cell's level differs from this one by more than some threshold.
  • Decide whether it reuses max_step_levels or needs its own separate, quarry-specific threshold — a slope steep enough to be interesting for a quarry site isn't necessarily the same steepness that blocks pawn movement.
  • Binary only, per the decision above — no richness/yield scaling by steepness.

Consumer

The Quarry facility's placement validation (not yet implemented) is the first and only planned consumer of this query.

`docs/resource-prospecting.md` says stone should be "richest against the side of a hill," and follow-up discussion settled that on the Quarry facility rather than a resource deposit: stone is extractable everywhere, but a Quarry may only be placed against sloped terrain (binary pass/fail, no yield gradient — deliberately dropping the "richest" framing from the doc). See #26 for the rest of that decision. ## The gap `TerrainGrid` (`scripts/terrain_grid.gd`) has no query that answers "is this tile against a slope." It tracks per-tile `level_at(cell)` and has neighbour-level-difference logic already, but only privately, inside `_can_traverse()`'s cliff check for pathfinding — not exposed as a general-purpose terrain query. ## Scope - Add a public query (e.g. `is_sloped(cell: Vector2i) -> bool`) that checks whether any neighbouring cell's level differs from this one by more than some threshold. - Decide whether it reuses `max_step_levels` or needs its own separate, quarry-specific threshold — a slope steep enough to be interesting for a quarry site isn't necessarily the same steepness that blocks pawn movement. - Binary only, per the decision above — no richness/yield scaling by steepness. ## Consumer The Quarry facility's placement validation (not yet implemented) is the first and only planned consumer of this query.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
liamjd/UntitledColonyBuilder#27
No description provided.