1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add player:override_day_night_ratio() for arbitrarily controlling sunlight brightness

This commit is contained in:
Perttu Ahola 2013-10-18 11:53:19 +03:00 committed by sapier
parent 86a6cca3cf
commit 6a3fa9df12
11 changed files with 107 additions and 2 deletions

View file

@ -49,7 +49,9 @@ Environment::Environment():
m_time_of_day(9000),
m_time_of_day_f(9000./24000),
m_time_of_day_speed(0),
m_time_counter(0)
m_time_counter(0),
m_enable_day_night_ratio_override(false),
m_day_night_ratio_override(0.0f)
{
}
@ -190,6 +192,8 @@ std::list<Player*> Environment::getPlayers(bool ignore_disconnected)
u32 Environment::getDayNightRatio()
{
if(m_enable_day_night_ratio_override)
return m_day_night_ratio_override;
bool smooth = g_settings->getBool("enable_shaders");
return time_to_daynight_ratio(m_time_of_day_f*24000, smooth);
}