Fix "I can't reach that." when closing doors from a distance#1013
Open
Tect0r wants to merge 1 commit into
Open
Fix "I can't reach that." when closing doors from a distance#1013Tect0r wants to merge 1 commit into
Tect0r wants to merge 1 commit into
Conversation
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.
Fix for #989
Summary
Closing an open door from a distance worked, but then incorrectly spammed "I can't reach that." Opening doors from a distance was unaffected.
Root cause
Door open/close uses an operate interaction through arriveDelay(). When the player has just taken the final step, the action resumes on the next tick inside checkDelay, before mode.tick() runs.
Closing swaps the open door for a closed one and updates Collisions.map with a blocking wall, but the Interact mode is not cleared. It then reaches mode.tick() in the same tick and re-checks reachability using the old open-door snapshot against the updated closed-door collision map. That makes reached() return false and falls through to cantReach().
Opening removes collision instead, so the stale interaction still resolves cleanly.
Fix
In Interact.tick(), clear an already-launched interaction once it has completed (suspension == null && !contains("delay")) instead of rechecking reachability against a mutated collision map.
This fixes doors and the broader case where completing an interaction mutates the target's collision.