Skip to content

aquifer: honor --skip-top and top-relative --levels - #5906

Merged
ab9rf merged 1 commit into
DFHack:developfrom
Alistair-Afton:aquifer-skip-top
Sep 15, 2026
Merged

ab9rf merged 1 commit into
DFHack:developfrom
Alistair-Afton:aquifer-skip-top

Conversation

@Alistair-Afton

@Alistair-Afton Alistair-Afton commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

aquifer drain, convert, and add accepted skip_top and levels parameters but never applied them, so e.g. aquifer drain --all --skip-top 2 silently removed every aquifer on the map instead of keeping the top two aquifer levels (fixes #5709).

Per the documented semantics these options only take effect with --all, so a top_relative flag is threaded through from the Lua CLI: drain/convert count down from the topmost existing aquifer level and add counts from the topmost level that can hold an aquifer tile, via the existing get_z_range helper.

get_z_range also now clamps to the explicit range's upper bound instead of ignoring it, so aquifer list <pos> <pos> and -z no longer report levels above the requested range.

Testing

  • Live fort: drain --all --skip-top 2 kept the top 2 aquifer levels and drained below; add --all --skip-top 2 --levels 5 added exactly the 5 expected levels; convert heavy --all --skip-top 2 converted below the top 2
  • Explicit-position drain/list unaffected
  • light-aquifers-only (aquifer convert light --all) behavior unchanged
  • ci/lint.py clean; plugin builds cleanly

@Alistair-Afton
Alistair-Afton force-pushed the aquifer-skip-top branch 2 times, most recently from 61c247c to be1bd4b Compare September 15, 2026 03:06
The drain, convert, and add actions accepted skip_top and levels
parameters but never applied them, so e.g. 'aquifer drain --all
--skip-top 2' silently removed every aquifer on the map instead of
keeping the top two aquifer levels.

Per the documented semantics these options only take effect with the
--all target, so a top_relative flag is threaded through from the Lua
CLI: drain/convert count down from the topmost existing aquifer level
and add counts from the topmost level that can hold an aquifer tile,
via the existing get_z_range helper that previously only served the
list action.

get_z_range also now clamps to the explicit range's upper bound instead
of ignoring it, so 'aquifer list <pos> <pos>' and '-z' no longer report
levels above the requested range.
@ab9rf
ab9rf merged commit e106d66 into DFHack:develop Sep 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aquifers incorrectly being removed

2 participants