Do not stop player-forced jobs when curPath is recalculated - #9
Open
SaintWacko wants to merge 5 commits into
Open
Do not stop player-forced jobs when curPath is recalculated#9SaintWacko wants to merge 5 commits into
SaintWacko wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts Avatar movement logic to avoid interrupting player-forced jobs when pather.curPath is recalculated (notably when crossing fences), preventing unintended StopDead() calls from halting intended AI execution of a forced job.
Changes:
- Added a
playerForcedguard to preventStopDead()from firing for player-forced jobs whencurPathis present. - Simplified existing
pather/curPathnull checks using the null-conditional operator.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: SaintWacko <10342141+SaintWacko@users.noreply.github.com>
Co-authored-by: SaintWacko <10342141+SaintWacko@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fix merge conflict: Do not stop player-forced jobs when curPath is recalculated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a pawn crosses over a fence, their
pather.curPathis recalculated twice, once on each side of it. When that happened, it triggeredpawn.pather.curPath != null, causingstopDead()to be called. I believe this was needed to prevent AI control from overriding WASD control, but it was causing problems when you did want your pawn to be AI-controlled (for example, when they are going to eat food). I added an additional check so that if your pawn is on a player-forced job, it will not callstopDead()and instead allow them to continue. I also shortened the existing path checks by using the null-conditional operator.