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

Pathfinding: Prevent NPCs to jump to open air #79314

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

Conversation

o175
Copy link
Contributor

@o175 o175 commented Jan 24, 2025

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

NPCs would try to go through tiles with no floor and fell down hurting
themselfs.
@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) NPC / Factions NPCs, AI, Speech, Factions, Ownership [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant