diff options
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/server.cpp b/src/server.cpp index 644aec1f5..5b799eb2c 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3291,6 +3291,23 @@ void Server::SendSetSky(u16 peer_id, const video::SColor &bgcolor, m_clients.send(peer_id, 0, data, true); } +void Server::SendOverrideDayNightRatio(u16 peer_id, bool do_override, + float ratio) +{ + std::ostringstream os(std::ios_base::binary); + + // Write command + writeU16(os, TOCLIENT_OVERRIDE_DAY_NIGHT_RATIO); + writeU8(os, do_override); + writeU16(os, ratio*65535); + + // Make data buffer + std::string s = os.str(); + SharedBuffer<u8> data((u8 *)s.c_str(), s.size()); + // Send as reliable + m_clients.send(peer_id, 0, data, true); +} + void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed) { DSTACK(__FUNCTION_NAME); @@ -4465,6 +4482,16 @@ bool Server::setSky(Player *player, const video::SColor &bgcolor, return true; } +bool Server::overrideDayNightRatio(Player *player, bool do_override, + float ratio) +{ + if (!player) + return false; + + SendOverrideDayNightRatio(player->peer_id, do_override, ratio); + return true; +} + void Server::notifyPlayers(const std::wstring msg) { SendChatMessage(PEER_ID_INEXISTENT,msg); |