-
Notifications
You must be signed in to change notification settings - Fork 9
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
Vector line draw functions #64
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.
pyndustri.pyi
should be updated to explain what these do.
Ok going to do that |
Done |
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.
Thanks. These functions only work with literals, and won't work with runtime variable values, right? So I'm wondering how useful are they, in practice?
Hmmm, I think its like that because it does the trig calculations during compilation of the program. Like for i in range(0, 360): Screen.flush()` Because the trig calculations are done during compilation, it tries to use "a" as the x0, not the value of a. |
Because of that its useless for now |
Like if you do a/2 it tries to use "__pyc_tmp_3" (string) as x0 |
@Lonami Is there a way in ast to check if a variable is a literal or variable name? And how to get the value of that variable? |
The value of variables is calculated while Mindustry runs the program. You cannot get it from the compiler, because the value may come from a sensor (such as reading how many items a container has). The only way is to do the calculations inside Mindustry too. Constant folding, which is in a way what you did here, is definitely useful and could be applied thorough the compiler (at the cost of increased complexity). I'm not sure we should start doing that until we figure out a clean design, but this is a whole difḟerent topic entirely. |
Screen.deg_line(x0, y0, degrees, magnitude)
-> Line with origin, degrees, and magnitudeScreen.rad_line(x0, y0, radians, magnitude)
-> Line with origin, radians, and magnitudePartially fixes #35 but wont be fully fixed until lists get added
This might be useful for game design, animations, and if someone decides to recreate a ti-84 in mindustry
Also fixes a small bug in sorted config test file