Skip to content

fix: clear construction mask for immediately-active buildings - #59

Merged
linkbag merged 1 commit into
mainfrom
feat/ic-verify-building-render
Mar 9, 2026
Merged

linkbag merged 1 commit into
mainfrom
feat/ic-verify-building-render

Conversation

@linkbag

@linkbag linkbag commented Mar 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Buildings spawned at game start or placed via HUD were invisible because the construction geometry mask (applied at constructionProgress=0, revealing zero pixels) was never cleared
  • clearMask() only fires inside updateConstruction(), which is skipped when building.state is directly set to 'active' by GameScene after creation
  • Fix detects constructionProgress < 1 when state is already active in Building.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 a GeometryMask to bodyGraphic. At progress=0 the mask shape is empty (height=0 rect), so the body is completely invisible. GameScene sets building.state = 'active' externally — updateConstruction() is never called — mask is never cleared.

Test plan

  • npx tsc --noEmit — no errors
  • npx vitest run — 62/62 tests pass
  • Visual smoke test: start a skirmish, verify buildings render as colored 3D boxes with DEF/BAR/REF/PWR/FAC labels

🤖 Generated with Claude Code

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>
@linkbag
linkbag merged commit ef0707a into main Mar 9, 2026
1 check 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.

1 participant