Skip to content

Conversation

@kumaryash6352
Copy link

Objective

Solution

Turn NavNeighbors from storing an array of Option<Entity> to an array of NavNeighbor, an enum with 3 values: Unset (no explicitly set thing in this direction), Blocked (assume there is nothing in this direction to path to), and Neighbor(Entity).

Testing

Changes tested using a new test, test_respects_set_blocks, and manually using the directional_navigation_override example. Each button on second page is restricted to left/right movement, as up/down are blocked.

Showcase

I'm not quite sure how to showcase this, as it's a very input-oriented feature and the feature working means that nothing happens.

Changes navigation to use a 3-state enum, distinguishing
between "unset" neighbors, "explicitly removed" neighbors,
and "known" neighbors. Unset neighbors can be overwritten by
auto nav building, while explicitly removed slots cannot.
Documents surprising behavior when inputting a
diagonal direction (ie. `NorthWest`) when
one of the components are blocked (ie. `North`)
pub enum NavNeighbor {
/// No neighbor explicitly set.
#[default]
Unset,
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this mean that it will be left to be determined automatically, so maybe Auto would be clearer?

Copy link
Author

Choose a reason for hiding this comment

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

Renamed to Auto in latest commit.

/// Do not find a neighbor.
Blocked,
/// The neighbor is known and set.
Neighbor(Entity),
Copy link
Contributor

Choose a reason for hiding this comment

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

NavNeighbor::Neighbor seems a bit redundant, maybe NavNeighbor::Set(Entity)?

Copy link
Author

Choose a reason for hiding this comment

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

Renamed to Set in latest commit.

.set(direction, b);
}

/// Adds an edge blocking automatic naviation from an entity in a direction.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Adds an edge blocking automatic naviation from an entity in a direction.
/// Adds an edge blocking automatic navigation from an entity in a direction.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for catching that, fixed typo in latest commit.

@kfc35 kfc35 added C-Feature A new feature, making something new possible A-UI Graphical user interfaces, styles, layouts, and widgets D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 22, 2026
@kfc35 kfc35 self-requested a review January 22, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants