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

Added scripting to rotating spotlight object + some changes #1689

Merged
merged 3 commits into from
Apr 27, 2021

Conversation

Semphriss
Copy link
Member

@Semphriss Semphriss commented Mar 7, 2021

Fixes #768

Added setters, faders, and easers for angle, rotation speed, and light color.

Also changed the direction variable to consider not rotating at all.

Also changed GameObjects to handle FadeHelpers globally. This will require a refactor of all GameObject-inheriting classes to call GameObject::update(float) where necessary.

Consideration: Although the "direction" property seems needless (as clockwise/counter-clockwise rotation can be achieved using positive or negative values), I chose to leave it there so that scripters can easily change the direction of a spotlight - or stop it completely - without having to know/remember its original speed in some way if they want to reset it at a later point.

@Semphriss Semphriss added status:needs-review Work needs to be reviewed by other people involves:scripting labels Mar 7, 2021
@Semphriss
Copy link
Member Author

Fixes #768

@weluvgoatz
Copy link
Member

This works great! I do have a small suggestion though; the "time" and "angle" parameters seem to be reversed in the scripting functions sometimes (see lines 59-62 of the src/scripting/spotlight.cpp, but this issue shows up throughout the file).

I don't know if this is intentional, as normal players won't see the difference if it's documented one way or another, but if it ends up being an oversight it should be fixed. Either way, I will merge it once that is fixed or turns out to be intentional. Thanks for this PR!

@Semphriss
Copy link
Member Author

image

If you are refering to this, it's normal; it's because the fade helper expects time to be first, but in scripting, I wanted to make it consistent (value is always the first argument, time is the second, and easing the third) to make it easier for scripters.

I double-checked, and arguments are ordered properly everywhere :D

@weluvgoatz
Copy link
Member

Thanks for clarification, and since it all works as intended, I'll merge this.

@weluvgoatz weluvgoatz merged commit cf3ee50 into master Apr 27, 2021
@mrkubax10 mrkubax10 removed the status:needs-review Work needs to be reviewed by other people label Jul 20, 2023
@mrkubax10 mrkubax10 deleted the spotlight_scripting branch August 18, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spotlight: expose to scripting API
3 participants