Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompose Grid.getShapedArea() so we can reuse logic between grids #4981

Merged

Conversation

kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented Oct 5, 2024

Identify the Bug or Feature request

Addresses #4980

Description of the Change

This refactors Grid.getShapedArea() for more consistency between grid types. The main goal was to allow IsometricGrid to reuse the main logic and transform the results rather than having to duplicate and specialize most of the logic for its unique circumstance.

With this change, isometric grid lighting behaves the same as for other grid types, save for the footprint area and 45° difference in the meaning of token facing. This means hex lights render as hexes, and beams are properly foreshortened. It also means no special logic for the other shapes, so we can be more confident that those will remain consistent into the future.

Possible Drawbacks

None. Unless folks want to complain about hexes being hexagonal.

Documentation Notes

N/A

Release Notes

  • Fixed a bug where hex lights were rendered as circles on isometric grids
  • Fixed a bug where beam lights were not foreshortened on isometric grids

This change is Reviewable

@kwvanderlinde kwvanderlinde added bug code-maintenance Adding/editing javadocs, unit tests, formatting. labels Oct 5, 2024
@kwvanderlinde kwvanderlinde self-assigned this Oct 5, 2024
We now calculate these things separately:
1. Which way the token is facing on the grid.
2. The shape of the light itself.
3. The shape of the token's footprint contribution to the light (for cones).

With this we gain the following benefits:
1. `IsometricGrid` can reuse the main shape logic and just transform the result. No more duplicated logic.
2. The code should be more approachable as each method does One Thing™.

Lights on isometric grids act literally the same as for square grids, just rotated and foreshortened. This fixes some
related bugs, e.g., beams not getting visually shorted when vertical. It also means iso grids now have a full set of
accurate lights available, e.g., hexes no longer default to ellipses.
@kwvanderlinde kwvanderlinde force-pushed the feature/4980-iso-shape-completeness branch from ff3de9a to cc98fef Compare October 11, 2024 01:46
Copy link
Collaborator

@bubblobill bubblobill left a comment

Choose a reason for hiding this comment

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

An improvement. One day this will all be pared down to something lean and sensible.

@cwisniew cwisniew added this pull request to the merge queue Oct 16, 2024
Merged via the queue into RPTools:develop with commit a6fe46d Oct 16, 2024
4 checks passed
@kwvanderlinde kwvanderlinde deleted the feature/4980-iso-shape-completeness branch October 21, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug code-maintenance Adding/editing javadocs, unit tests, formatting.
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants