Skip to content

Fix X-Ray for multi-hex movement previews#3172

Draft
emptyteabot wants to merge 1 commit into
FreezingMoon:masterfrom
emptyteabot:fix-xray-above-footprint
Draft

Fix X-Ray for multi-hex movement previews#3172
emptyteabot wants to merge 1 commit into
FreezingMoon:masterfrom
emptyteabot:fix-xray-above-footprint

Conversation

@emptyteabot

Copy link
Copy Markdown

Summary

  • add a shared helper that computes the full hex footprint for hovered move/target previews
  • pass that full footprint into X-Ray so medium and large units ghost blockers for every occupied preview hex, not only the cursor hex
  • keep the last footprint available for X-Ray reapply paths and clear it at turn-boundary cleanup

Testing

  • npx eslint src/utility/query_footprint.ts src/utility/hexgrid.ts src/tests/utility/query_footprint.ts src/tests/utility/hexgrid-xray.ts
  • npx jest src/tests/utility/query_footprint.ts src/tests/utility/hexgrid-xray.ts --runInBand
  • npx tsc --noEmit
  • npm run build
  • npx jest --runInBand

/claim #1301

Payout note: if this bounty can be paid as an EVM stablecoin instead of XTR, wallet is 0xe2e86bdb8753c24032f2ad42b4c1bd9748385a7d.

@vercel

vercel Bot commented May 13, 2026

Copy link
Copy Markdown

@emptyteabot is attempting to deploy a commit to the FreezingMoon Team on Vercel.

A member of the Team first needs to authorize it.

@emptyteabot emptyteabot force-pushed the fix-xray-above-footprint branch from 79c0146 to 3473264 Compare May 13, 2026 14:12
@emptyteabot

Copy link
Copy Markdown
Author

Ready for review. The failing Vercel status is a team authorization block for the preview deployment, not a build/runtime failure from this PR. Local verification was completed before submission.

@vercel

vercel Bot commented May 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ancientbeast Ready Ready Preview May 20, 2026 12:55pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves X-Ray behavior during hovered movement/target previews for medium/large creatures by computing the full multi-hex preview footprint and applying X-Ray across every hex in that footprint (instead of only the cursor hex), while also preserving the last computed footprint for X-Ray reapply flows.

Changes:

  • Added getQueryFootprintHexes() helper to compute the full multi-hex footprint for hovered previews (including flipped-player offset and walkability adjustment).
  • Updated HexGrid.queryHexes() hover path to pass the computed footprint into HexGrid.xray() so X-Ray ghosts blockers for all occupied preview hexes.
  • Extended HexGrid.xray() to accept an optional footprint, cache/reuse it for reapply paths, and clear it during clearAllXray(), with added Jest coverage for the new behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/utility/query_footprint.ts Adds a shared helper to compute the occupied hex footprint for hovered multi-hex previews.
src/utility/hexgrid.ts Threads preview footprint into X-Ray, caches it for reapply, and clears it at turn-boundary cleanup.
src/__tests__/utility/query_footprint.ts Adds unit tests validating footprint computation for flipped/non-flipped multi-hex previews.
src/__tests__/utility/hexgrid-xray.ts Adds a unit test ensuring X-Ray applies ghostOverlap() for every hex in the preview footprint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@emptyteabot emptyteabot force-pushed the fix-xray-above-footprint branch from 3473264 to ce0b480 Compare May 19, 2026 13:30
@emptyteabot

Copy link
Copy Markdown
Author

Rebased onto latest master and resolved the xray/footprint conflict. Added a small test-harness fix for the animations suite, then verified locally with
pm test -- --runInBand (lint + production build + all Jest suites).

@DreadKnight

Copy link
Copy Markdown
Member

@emptyteabot There's a conflict with master. Anyway, I can't quite figure if this actually improves anything or not.
Guess will have @copilot evaluate it next month or feel free to showcase scenarios where it's better or something.

@DreadKnight DreadKnight marked this pull request as draft May 28, 2026 18:16
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.

3 participants