Implicit waitstate for special/specialvars #2200
Open
+132
−317
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.
specialandspecialvars that are always followed by awaitstatenow implicitly generate thatwaitstatewhen called. This should make it easier to use those specials for newcomers who have not internalized "a UI special needs awaitstateafter it to stop the script progressing to a disastrous result".If an implicit
waitstateis immediately followed by an explicitwaitstatethe second one is ignored and a warning is reported, thus making the change harmless for downstream projects (if a little noisy). If there are other instructions between the implicit and explicitwaitstates then both are generated, which would manifest as a softlock; I think writing code like that is unidiomatic, so hopefully this will not affect (m)any downstream projects.The candidate
specials were mostly identified with the following:git grep -B1 waitstate data | grep -v '^-' | sed 'N;s/\n/ /;p' | grep -o 'special [a-zA-Z0-9_]*' | sort -u.Notable
specials that are not always followed bywaitstateareEnterSecretBase,RunUnionRoom, andShakeCamera. Of these,ShakeCamerais particularly disappointing because 22/24 of the uses are immediately followed bywaitstate. In the future we could consider extendingspecialto support this use-case.Discussed in the pret and rh-hideout Discord servers.