-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Rework number parser and angle support #7139
base: dev/feature
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be baked into the number parser. That way it can be used in contexts where only literals are accepted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only had a quick look through but looks good! The only thing I'd say is that the test could maybe cover some edge cases too (e.g. NaN, infinity, invalid values like strings, etc.)?
# Conflicts: # src/main/java/ch/njol/skript/classes/data/JavaClasses.java # src/main/java/ch/njol/skript/effects/EffVectorRotateAroundAnother.java # src/main/java/ch/njol/skript/effects/EffVectorRotateXYZ.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests failing :(
Skript.registerExpression(ExprAngle.class, Number.class, ExpressionType.SIMPLE, | ||
"%number% [in] deg[ree][s]", | ||
"%number% [in] rad[ian][s]", | ||
"%numbers% in deg[ree][s]", | ||
"%numbers% in rad[ian][s]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to support gradians (grad[s]/gon) while you're here?
They're pretty obscure nowadays so I don't mind, but you do occasionally see them used in map stuff and cartography.
Good PR. I wondered about supporting the symbols too (e.g. |
Description
Reworks number parser. Adds support for angles. When using
x degrees
, it is just syntactic sugar forx
. When usingx radians
, convertsx
to degrees.Target Minecraft Versions: any
Requirements: none
Related Issues: none