Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EvtAtTime not triggering when world time has been changed. #6463

Merged
merged 2 commits into from
Mar 1, 2024

Conversation

sovdeeth
Copy link
Member

Description

The previous logic in EvtAtTime kept track of which event instance should be triggered next in a world. This works great and helps performance when the time in a world flows linearly without interruption. However, if the world time ever changes abruptly, Skript is still looking for the old "next event". So if you have 6:00 and 8:00 registered, but at 7:00 you jump back to 5:00, then the 6:00 won't trigger again, because Skript's looking for that 8:00 that "should" be next.

This change instead forces Skript to check all events against the current time (minus the ones that are ahead of the current world time). This is slightly worse for performance (very marginal) but ensures safety against time skips.

It also uses a PriorityQueue instead of re-sorting the whole list when adding events, fixes a bug where the repeating task wasn't actually cancelled on unload, and cleans up the code a bit.


Target Minecraft Versions: any
Requirements: none
Related Issues: #6462

@sovdeeth sovdeeth added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. 2.8 Targeting a 2.8.X version release labels Feb 25, 2024
@sovdeeth sovdeeth added the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Feb 29, 2024
@APickledWalrus APickledWalrus merged commit 69eb15f into SkriptLang:dev/patch Mar 1, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.8 Targeting a 2.8.X version release bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants