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

[CR] Pathfinding accounts for SMALL_PASSAGE #77446

Merged
merged 7 commits into from
Nov 5, 2024

Conversation

harakka
Copy link
Member

@harakka harakka commented Oct 30, 2024

Summary

Bugfixes "Pathfinding accounts for SMALL_PASSAGE"

Purpose of change

Fixes #77385

Describe the solution

  • Sets the so far-unused PathfindingFlag::RestrictLarge and PathfindingFlag::RestrictHuge flags, added in Replace pf_special with a scoped enum (PathfindingFlag) and add more flags #76026, for SMALL_PASSAGE terrain
  • Check for that flag when calculating pathfinding costs to make the terrain count as impassable
  • Update pathfinding settings to account for size
  • Make character's settings update as their size category changes.

I added the check for openable but impassable terrain as its own if block instead of trying to integrate it into the already existing one below it for sake of readability.

TODO before undrafting

  • Make the struct member nullable or something so that it doesn't need to be checked for pathfinding that doesn't need to know about character size, particularly for dropping items on the floor
  • Figure out how to handle closed windows, which the pathfinder sees as openable, but doesn't know they're not necessarily passable once open

Describe alternatives you've considered

Testing

Tested with repro save from #77385:
0. Load repro save
1 . O -> Sort out my loot (static zones only)
2. Observe that character will not try to open windows or pass through window frames
3. Load save again
4. Debug edit away the "Incoveniently large" mutation
5. Observe that character now paths through window frames and opens windows from the inside while looting progresses

Additional context

Draft for 0.H version of the fix #77550

@harakka harakka marked this pull request as draft October 30, 2024 07:36
@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Oct 30, 2024
@harakka
Copy link
Member Author

harakka commented Oct 31, 2024

This implementation currently stops at a closed window, opens it, and states you can't fit through so you have to re-trigger sorting whenever that happens. I'm still working on fixing that.
Edit: sorted now

@harakka harakka marked this pull request as ready for review November 3, 2024 07:36
@harakka harakka changed the title Pathfinding accounts for SMALL_PASSAGE [CR] Pathfinding accounts for SMALL_PASSAGE Nov 3, 2024
@kevingranade kevingranade merged commit 582f33f into CleverRaven:master Nov 5, 2024
22 of 28 checks passed
kevingranade pushed a commit that referenced this pull request Nov 6, 2024
)

* Backport pathfinding fixes for large creatures
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 Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loot sorting pathing failure due to character being large
2 participants