Fixes locker breakout do-after #34870
Open
+42
−34
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.
About the PR
The do-after for breaking out of lockers now cancels early if the locker is unwelded or unlocked, and the door opens as early as available.
Why / Balance
The current do-after is a bit jank, it doesn't stop even when the door was wide open.
Technical details
isResisting
checks kind of did nothing besides try to prevent the do-after from getting cancelled. It prevented the do-after from getting cancelled becauseContainerRelayMovementEntityEvent
sends an event on movement keydown and keyup, and it tried to start a new do-after at each instance. The duplicate do-after would cancel the ongoing do-after. We can achieve this by setting the doafter argCancelDuplicate
to false, preventing additional do-after attempts from cancelling our ongoing do-after.AttemptFrequency
was set to every tick, this causesDoAfterAttemptEvent
to get raised every tick. We check whether we can early cancel the do-after every tick in the newResistDoafterEarlyCancel()
function, which cancels the do-after if the locker no longer exists (deleted from damage), or if the locker is both unwelded and unlocked. When this happens, it also attempts to open the locker immediately.Entity<T> entity
code standard.Media
It normally takes two minutes to break out of a locker. The time was edited to five seconds for the videos.
Before the changes:
2025-02-04.09-15-30.mp4
After the changes:
Locked:
2025-02-03.19-38-47.mp4
Welded:
2025-02-03.19-39-38.mp4
Welded and locked:
2025-02-03.19-40-04.mp4
Requirements
Breaking changes
ResistLockerComponent isResisting field has been removed.
ResistLockerSystem functions changed to use the
Entity<T> entity
format.Changelog
🆑