mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
minetest.register_on_player_receive_fields()
This commit is contained in:
parent
506203345b
commit
4cc98d7add
11 changed files with 127 additions and 3 deletions
|
@ -3248,6 +3248,22 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
scriptapi_node_on_receive_fields(m_lua, p, formname, fields,
|
||||
playersao);
|
||||
}
|
||||
else if(command == TOSERVER_INVENTORY_FIELDS)
|
||||
{
|
||||
std::string datastring((char*)&data[2], datasize-2);
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
std::string formname = deSerializeString(is);
|
||||
int num = readU16(is);
|
||||
std::map<std::string, std::string> fields;
|
||||
for(int k=0; k<num; k++){
|
||||
std::string fieldname = deSerializeString(is);
|
||||
std::string fieldvalue = deSerializeLongString(is);
|
||||
fields[fieldname] = fieldvalue;
|
||||
}
|
||||
|
||||
scriptapi_on_player_receive_fields(m_lua, playersao, formname, fields);
|
||||
}
|
||||
else
|
||||
{
|
||||
infostream<<"Server::ProcessData(): Ignoring "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue