Pathfinding: Prevent NPCs to jump to open air #79314
Open
+3
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pathfinding: Prevent NPCs falling while trying to navigate through open air tile
Summary
Bugfixes "Pathfinding: Avoid NPCs falling down to open air"
Purpose of change
NPCs would try to go through tiles with no floor and fell down hurting themselves. I noticed this when navigating two-storey locations like mansions.
Describe the solution
Add check to npc::get_path_avoid();
Describe alternatives you've considered
Considered modifying the sees_dangerous_field function. But that function does not seem appropriate for this logic
Testing
Created a save with a hole in a roof to test this exact behavior. Before the change NPC was falling down in the hole while following PC. After he started to go around the hole. I provide the save If you want to test it yourself.
Commerce City-trimmed.tar.gz
Autotests are green.
Additional context