Skip to content

Improve API for tracking delayed execution at runtime. #7777

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

Draft
wants to merge 2 commits into
base: dev/feature
Choose a base branch
from

Conversation

sovdeeth
Copy link
Member

@sovdeeth sovdeeth commented Apr 5, 2025

Description

The current method of checking if the current execution has been delayed utilises Delay.isDelayed(Event), which returns whether a delay has been run in that event before. If the event only corresponds to a single trigger, this is ok. However, as soon as 2 triggers enter the picture, problems arise:

on jump:
  send isDelayed # sends false
  wait 1 tick # adds to DELAYED
  send isDelayed # sends true

on jump:
  send isDelayed # uh oh, this ran after the first event, so the event's already in DELAYED! returns TRUE
  wait 1 tick
  send isDelayed # sends true

This PR attempts to resolve that by moving this logic to Trigger, so each trigger tracks whether it has been delayed for an Event or not. The old methods are deprecated and marked for removal, but are still functional.

Current issues/concerns:

  • Grabbing a Trigger from an Expression context
  • Is getTrigger reliable when working with sections that completely overwrite context, like EffSecSpawn?

Some simple cleanup was done to classes affected by the deprecation. Anything more is out of scope.


Target Minecraft Versions: any
Requirements: none
Related Issues: #7393 (not a fix)

Worries about sections that start completely new events, and worries about getting trigger from Expresssions
@sovdeeth sovdeeth added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something. labels Apr 5, 2025
Efnilite
Efnilite previously approved these changes Apr 5, 2025
@sovdeeth sovdeeth dismissed Efnilite’s stale review April 7, 2025 00:00

This is not in a state for approval; it does not even build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants