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
Allow to set maximum star opacity at daytime #11663
Conversation
Looks promising from a quick test, but haven't given this a full pass yet. That said, this needs to be rebased and fixed to work with master. This is missing changes to compile with the latest IrrlichtMt, and if we rebase to get them the code no longer compiles without modification due to #11983. The fix is fairly trivial though, it's a 1-liner. |
f350a86
to
cd5fa31
Compare
The rebase is complete. |
Just a quick note--I saw the notification, and will be reviewing this weekend. I'm taking a break from reviews this week since I'm participating in a game jam, but this is at the top of my list and will probably get looked at again on Saturday. |
Tested, seems to work as intended.
I did see one odd thing--at time speed 720 (2 minute cycle), the stars 'warp' to new positions around sunrise. At time speed 72 though, this did not occur. It could be an existing behavior that wasn't visible before, I'm not sure if we want to investigate it now or not worry about it for the time being. |
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.
One other thing I'd like to raise before approving: Should we have night_opacity
or some variant thereof? It may sound redundant at a glance, but I suspect we can't presently make daytime stars brighter than nighttime ones even with this change.
I'm not sure how useful this feature is, but it seems like it could be worthwhile to have the option available for the sake of flexibility. Any opinions from others would be appreciated.
This does not seem to happen reliably, tho, only sometimes. And it's also the sun and moon that suddenly "jump". So I think this must be an old, unrelated issue. Won't touch.
Won't do. I don't see a need right now. But if it will be needed, there is always chance for another PR. |
tested |
Fixes #9887. Successor of #10541.
This PR adds a new Lua API feature to
player:set_stars
:day_opacity
. This is a floating point number between 0.0 and 1.0. It sets the maximum opacity of stars at daytime, with 1.0 meaning fullbright stars (same as night) and 0.0 being fully invisible.Technically, the mechanism to do this is very simple: A value of X just means the star opacity is capped at X at daytime, meaning it cannot get more opaque during the day.
The default value is 0.0 and this feature is backwards-compatible. I've tested a 5.5.0-dev client on a 5.4.0 server and it worked.
Note: The word "opacity" here means the opacity of the stars BEFORE
star_color
is applied. This means "full opacity" here means that the full effect color ofstar_color
is applied, it does not neccessarily mean that the stars are actually fully opaque. Stars never get more opaque than the alpha value of thestar_color
, like before. This is NOT new behavior, I just pointed that out for clarity.To do
Ready for review.
How to test
Function test in 5.5.0-dev:
luacmd
mod/lua me:set_stars({star_color="#FF0000FF"})
(this is optional, but red stars are better for testing; also note the defaultstar_color
is not fully opaque, so don't be surprised ifday_opacity=1
doesn't make the stars fully opaque when using the defaultstar_color
)/time 12000
/lua me:set_stars({day_opacity=1})
/lua me:set_stars({day_opacity=0})
/time 0
/lua me:set_stars({day_opacity=1})
/time 12000
/lua me:set_stars({day_opacity=0.75})
Feel free to try out other opacity values.
Also try to let a full day/night circle complete (under various conditions) to check whether the transition is still smooth in all cases. You could do
/set time_speed 300
to speed things up.Compability test: