Repository navigation
fix: clear construction mask for immediately-active buildings - #59
Merged
Merged
Conversation
Buildings created with state forced to 'active' (game start spawn, HUD placement) had their bodyGraphic permanently masked because playConstructionAnimation() applied a geometry mask at progress=0 (revealing zero pixels), and clearMask() only fires via the normal updateConstruction() path which is skipped for instantly-active buildings. Fix: detect constructionProgress<1 when state is already active in update() and finalize visuals (clearMask, reset alpha/offset, redraw body+label) on the first frame. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
constructionProgress=0, revealing zero pixels) was never clearedclearMask()only fires insideupdateConstruction(), which is skipped whenbuilding.stateis directly set to'active'by GameScene after creationconstructionProgress < 1when state is alreadyactiveinBuilding.update()and finalizes visuals on the first frame (clears mask, resets alpha/y-offset, redraws body+label)Root cause
playConstructionAnimation()in the constructor immediately applies aGeometryMasktobodyGraphic. Atprogress=0the mask shape is empty (height=0 rect), so the body is completely invisible. GameScene setsbuilding.state = 'active'externally —updateConstruction()is never called — mask is never cleared.Test plan
npx tsc --noEmit— no errorsnpx vitest run— 62/62 tests pass🤖 Generated with Claude Code