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

@ -2045,6 +2045,20 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
event.set_sky.params = params;
m_client_event_queue.push_back(event);
}
else if(command == TOCLIENT_OVERRIDE_DAY_NIGHT_RATIO)
{
std::string datastring((char *)&data[2], datasize - 2);
std::istringstream is(datastring, std::ios_base::binary);
bool do_override = readU8(is);
float day_night_ratio_f = (float)readU16(is) / 65536;
ClientEvent event;
event.type = CE_OVERRIDE_DAY_NIGHT_RATIO;
event.override_day_night_ratio.do_override = do_override;
event.override_day_night_ratio.ratio_f = day_night_ratio_f;
m_client_event_queue.push_back(event);
}
else
{
infostream<<"Client: Ignoring unknown command "