getplants: add dry-run and trait filter options - #5949
Open
Alistair-Afton wants to merge 1 commit into
Open
Alistair-Afton wants to merge 1 commit into
Alistair-Afton wants to merge 1 commit into
Conversation
Adds --dry-run (-d) to report how many plant designations would be set or cleared without changing anything, and --brewable/--edible/ --oil/--cloth/--dye trait filters that restrict the selection (and the ID listing) to plants with the requested uses. Trait filters compose with -a, explicit IDs, -x, -t/-s, -f, and -c. Brewable and oil-bearing plants are identified by the material reaction products the vanilla brewing and pressing reactions require (DRINK_MAT and PRESS_LIQUID_MAT), checked on the structural material, the seed material, and all growth materials. Cloth plants are detected via the THREAD flag, edible plants via EDIBLE_RAW, and dye plants via IS_DYE on mill/extract materials and growths. Closes DFHack#5768
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements both parts of #5768:
Dry run:
-d/--dry-runreports how many plant designations would be set or cleared without changing anything, usingDesignations::canMarkPlant/canUnmarkPlantso the count is exactly what a real run would produce (all existing ripeness/already-picked/already-designated checks still apply).Trait filters:
--brewable,--edible,--oil,--cloth, and--dyerestrict the selection to plants with the requested uses. They compose with-a, explicit IDs,-x(invert stays within the filtered pool),-t/-s,-f, and-c, and they also restrict the valid-ID listing (getplants --brewablelists brewable species).Trait detection uses the same criteria as the vanilla reactions:
--brewable:DRINK_MATreaction product on the structural material or any growth material (as required byBREW_DRINK_FROM_PLANT/_GROWTH)--oil:PRESS_LIQUID_MATreaction product on the seed material (milled to paste) or growth materials (pressed directly)--edible:EDIBLE_RAWon the structural material or any growth material--cloth: theTHREADplant flag--dye:IS_DYEon mill/extract material defs or growth materialsVerified in-game on 53.16:
--brewablelists exactly the vanilla brewables (wheats, berries, rat weed, etc.),--cloththe thread plants,--dyethe four dye plants (dimple cup, blade weed, hide root, sliver barb), and--oilthe pressable species (flax/hemp/cotton/kenaf seeds, olive, quarry bush). Dry-run reports match real runs exactly.New in-engine regression test
test/plugins/getplants.luacovers dry-run/real-run parity, designation round-tripping, trait filter acceptance/rejection, and listing correctness. 3/3 tests, 98/98 checks pass.Closes #5768