Fix scared animation from lightning strikes preventing forced song event animations from playing #171
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 FunkinCrew/Funkin#4376
It seems that Kade attempted to fix this issue in this commit, but this change doesn't work if the lightning strike happens to occur on the same beat that Boyfriend plays the cheer animation. In fact, even without this change, the cheer animation works correctly if the lightning strike happens on the beat directly before or after the animation. The issue only occurs if they happen on the same beat.
The change from the aforementioned commit doesn't work because the stage script is processed before song events from the chart data. This means that Boyfriend hasn't tried to play the cheer animation yet, so
getBoyfriend().animation.name != 'cheer'
won't work to prevent this.This PR fixes the issue by getting all forced
PlayAnimation
events which target boyfriend. Then when a lightning strike happens, the script checks whether any of these events happen on the current beat. If there is an event that should play on the current beat, this means that the boyfriend character has a forced animation to play, so they won't play the scared animation.Video Comparison
Here is a video of a lighting strike playing on the exact same beat as the cheer animation before the change from this PR:
lightning-interrupt.mp4
Here is a video of the same after the change from this PR:
cheer-not-interrupted.mp4