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

Allow defining player's inventory form in Lua

This commit is contained in:
Perttu Ahola 2012-07-19 14:09:16 +03:00
parent 02fb912a95
commit 16ad10e62f
10 changed files with 129 additions and 10 deletions

View file

@ -1688,6 +1688,16 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
}
infostream<<std::endl;
}
else if(command == TOCLIENT_INVENTORY_FORMSPEC)
{
std::string datastring((char*)&data[2], datasize-2);
std::istringstream is(datastring, std::ios_base::binary);
// Store formspec in LocalPlayer
Player *player = m_env.getLocalPlayer();
assert(player != NULL);
player->inventory_formspec = deSerializeLongString(is);
}
else
{
infostream<<"Client: Ignoring unknown command "