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:
parent
36f03a7f4a
commit
da9707950e
8 changed files with 129 additions and 2 deletions
|
@ -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 "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue