Drop pull-aware fatigue when puller has died mid-tick#156
Open
misterwise wants to merge 1 commit intoscreeps:masterfrom
Open
Drop pull-aware fatigue when puller has died mid-tick#156misterwise wants to merge 1 commit intoscreeps:masterfrom
misterwise wants to merge 1 commit intoscreeps:masterfrom
Conversation
When a puller dies of TTL on the same tick a pull resolves, the move's
body-weight fatigue could be stranded on the pulled creep instead of
dying with the puller. Reproduction (screeps-ok catalog MOVE-PULL-012):
a 2-MOVE puller pulls a 2-WORK harvester; on the puller's last tick,
the puller is iterated first, `movement.execute` then the lifetime
check calls `_die` and `delete roomObjects[puller._id]`. The pulled
creep's later `movement.execute` enters `_add-fatigue` and the chain
walk
while(!!object._pulled && !!roomObjects[object._pulled]) {
object = roomObjects[object._pulled];
}
silently terminates because the puller is gone, then applies the move's
fatigue to the pulled creep itself. With no MOVE parts to clear it the
harvester is stuck forever (fatigue=4). Vanilla happens to produce the
intended outcome when the pulled creep is iterated first, so the
visible behavior was order-dependent.
Distinguish "no `_pulled`" (genuine chain head) from "`_pulled` but
target missing" (dead puller). In the dead-link case return without
landing fatigue anywhere — the move's pull-aware fatigue is buried with
the puller it should have routed to. The "rest first" branch is
preserved verbatim, so the negative-dFatigue / own-MOVE-clear path is
unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 puller dies of TTL on the same tick a pull resolves, the move's body-weight fatigue could be stranded on the pulled creep instead of dying with the puller. Reproduction: a 2-MOVE puller pulls a 2-WORK harvester; on the puller's last tick, the puller is iterated first,
movement.executethen the lifetime check calls_dieanddelete roomObjects[puller._id]. The pulled creep's latermovement.executeenters_add-fatigueand the chain walksilently terminates because the puller is gone, then applies the move's fatigue to the pulled creep itself. With no MOVE parts to clear it the harvester is stuck forever (fatigue=4). Vanilla happens to produce the intended outcome when the pulled creep is iterated first, so the visible behavior was order-dependent.
Distinguish "no
_pulled" (genuine chain head) from "_pulledbut target missing" (dead puller). In the dead-link case return without landing fatigue anywhere — the move's pull-aware fatigue is buried with the puller it should have routed to. The "rest first" branch is preserved verbatim, so the negative-dFatigue / own-MOVE-clear path is unchanged.