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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

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

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 added bug code-maintenance Adding/editing javadocs, unit tests, formatting. labels Oct 5, 2024
@kwvanderlinde kwvanderlinde self-assigned this Oct 5, 2024
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: Todo
Development

Successfully merging this pull request may close these issues.

1 participant