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

Include subroutines used in actions in the compiled output of the Editor #399

Conversation

netux
Copy link
Contributor

@netux netux commented Jan 22, 2024

While there is linter logic to catch these, it is sometimes hard to see the linter error in certain cases.

An argument can be made that, because the in-game editor allows for creating a subroutine but never defining a rule for it, we should also allow it as well.

In fact, this change fixes a case where importing a snippet that declares a subroutine but never define it, then compiling the project and trying to import that into the game would cause a workshop error because we stripped the subroutine from the subroutines list.

Also: refactor getSubroutines to use String.matchAll(), which is a bit better than String.match() and a ton of String.replace()s.

…d Start Rule actions in the compiled output

While there is linter logic to catch these, it is sometimes hard to see the linter error in certain cases.

An argument can be made that, because the in-game editor allows for creating a subroutine but never defining a rule for it, we should also allow it as well.

In fact, this change fixes a case where importing a snippet that declares a subroutine but never define it, then compiling the project and trying to import that into the game would cause a workshop error because we stripped the subroutine from the subroutines list.

Also: refactor `getSubroutines` to use `String.matchAll()`, which is a bit better than `String.match()` and a ton of `String.replace()`s.
Copy link
Owner

@Mitcheljager Mitcheljager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, seems like a good fix

@Mitcheljager Mitcheljager merged commit 0ef2288 into Mitcheljager:master Jan 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants