Fix drafted-move desync from unsynced EndCurrentJob in PawnGotoAction#957
Open
cmlee119 wants to merge 1 commit into
Open
Fix drafted-move desync from unsynced EndCurrentJob in PawnGotoAction#957cmlee119 wants to merge 1 commit into
cmlee119 wants to merge 1 commit into
Conversation
When a group of drafted pawns is given a move order, PawnGotoAction runs once per pawn on the client that issued the order. We already sync its TryTakeOrderedJob call, but it has another path: when a pawn is already standing on gotoLoc and its current job is Goto, it calls Pawn_JobTracker.EndCurrentJob directly. That call isn't synced, so the pawn stops only for the player who issued the order while it keeps walking for everyone else, causing a desync. Redirect that EndCurrentJob call to a synced wrapper through the existing DraftedMove_GotoFeedbackPatch transpiler, the same way the TryTakeOrderedJob call in the same method is already handled.
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.
Fixes #849.
PawnGotoActionruns once per pawn on the client that issues a drafted move order. We already sync itsTryTakeOrderedJobcall, but it has another path: when a pawn is already standing ongotoLocand its current job isGoto, it callsPawn_JobTracker.EndCurrentJobdirectly. That call isn't synced, so the pawn stops only for the player who issued the order while it keeps walking for everyone else, causing a desync.This redirects that
EndCurrentJobcall to a synced wrapper through the existingDraftedMove_GotoFeedbackPatchtranspiler, the same way theTryTakeOrderedJobcall is handled — the first solution proposed in #849.Repro: draft a group, give a long move order, then while they're still walking re-issue a move onto the cells they're currently standing on. Desynced 3/3 for me; with this change I couldn't reproduce it in 10 attempts. I've also been running it as a small separate mod in our ongoing multiplayer game with no issues so far.