Add option to count stackable plants as a single plant#285
Merged
Conversation
New config option stacked-plants-count-as-one (default false, current behaviour). When enabled, a column of SUGAR_CANE or BAMBOO counts as one plant toward the limit no matter how tall it grows: segments sitting on the same plant are not counted at placement or growth, the break cascade does not decrement stems, and the recount applies the same rule so live counts and recounts agree. BAMBOO_SAPLING normalises to BAMBOO so a stem above a sapling still reads as the same plant. Fixes #53 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015dbJyrv2uxHfTmiWkqGUJB
89607bb to
06ee8eb
Compare
|
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.



Fixes #53.
Adds the config option Poslovitch suggested on the ticket:
How it works
One rule, applied in three places: a stackable segment sitting on the same plant is invisible to counting — only the base segment represents the plant.
process()(all place/grow/spread paths funnel through it): segments above the same plant are skipped for counting, limit checks, and decrements.handleBreak(): the existing stem-cascade decrement is disabled when the option is on, since stems were never counted. Breaking a middle stem leaves the plant counted (the base still stands); breaking the base decrements the one counted plant.RecountCalculator: the column scan skips a stackable whose block below normalised to the same plant, so recounts agree with live counts.BAMBOO_SAPLINGnormalises toBAMBOO(existing variant map), so a stem above a sapling reads as the same plant. Default off preserves today's per-segment behaviour exactly — the config comment tells admins to run a recount after flipping the option.Tests
Segment-not-counted, base-counted, and break-decrements-exactly-one cases, plus config parsing; the pre-existing cascade test pins the default-off behaviour. Full suite green.
In-game test plan
SUGAR_CANE: 5, restart./is limitsstill 5/5./is limits recountat any point → number unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_015dbJyrv2uxHfTmiWkqGUJB