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

Add TOCLIENT_SHOW_FORMSPEC to display formspecs at client from lua

This commit is contained in:
sapier 2013-01-02 19:45:04 +00:00 committed by Perttu Ahola
parent 36f03a7f4a
commit da9707950e
8 changed files with 129 additions and 2 deletions

View file

@ -1900,6 +1900,20 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
}
inv->deSerialize(is);
}
else if(command == TOCLIENT_SHOW_FORMSPEC)
{
std::string datastring((char*)&data[2], datasize-2);
std::istringstream is(datastring, std::ios_base::binary);
std::string formspec = deSerializeLongString(is);
ClientEvent event;
event.type = CE_SHOW_FORMSPEC;
// pointer is required as event is a struct only!
// adding a std:string to a struct isn't possible
event.show_formspec.formspec = new std::string(formspec);
m_client_event_queue.push_back(event);
}
else
{
infostream<<"Client: Ignoring unknown command "