]> git.lizzy.rs Git - minetest.git/blobdiff - src/client.cpp
Add player:set_sky() with simple skybox support
[minetest.git] / src / client.cpp
index cc1ec2a9891faf598a2c95a81a14ffe5259fee1a..48b00377f36138077191cf76399ce92a2ef7c8a3 100644 (file)
@@ -2026,6 +2026,25 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
                        ((LocalPlayer *) player)->hotbar_selected_image = value;
                }
        }
+       else if(command == TOCLIENT_SET_SKY)
+       {
+               std::string datastring((char *)&data[2], datasize - 2);
+               std::istringstream is(datastring, std::ios_base::binary);
+
+               video::SColor *bgcolor = new video::SColor(readARGB8(is));
+               std::string *type = new std::string(deSerializeString(is));
+               u16 count = readU16(is);
+               std::vector<std::string> *params = new std::vector<std::string>;
+               for(size_t i=0; i<count; i++)
+                       params->push_back(deSerializeString(is));
+
+               ClientEvent event;
+               event.type = CE_SET_SKY;
+               event.set_sky.bgcolor = bgcolor;
+               event.set_sky.type = type;
+               event.set_sky.params = params;
+               m_client_event_queue.push_back(event);
+       }
        else
        {
                infostream<<"Client: Ignoring unknown command "