mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Add formspec theming using prepended strings
This commit is contained in:
parent
040b878cd5
commit
2323842dd3
16 changed files with 150 additions and 18 deletions
|
@ -1870,7 +1870,7 @@ void Server::SendPlayerInventoryFormspec(session_t peer_id)
|
|||
{
|
||||
RemotePlayer *player = m_env->getPlayer(peer_id);
|
||||
assert(player);
|
||||
if(player->getPeerId() == PEER_ID_INEXISTENT)
|
||||
if (player->getPeerId() == PEER_ID_INEXISTENT)
|
||||
return;
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_INVENTORY_FORMSPEC, 0, peer_id);
|
||||
|
@ -1878,6 +1878,18 @@ void Server::SendPlayerInventoryFormspec(session_t peer_id)
|
|||
Send(&pkt);
|
||||
}
|
||||
|
||||
void Server::SendPlayerFormspecPrepend(session_t peer_id)
|
||||
{
|
||||
RemotePlayer *player = m_env->getPlayer(peer_id);
|
||||
assert(player);
|
||||
if (player->getPeerId() == PEER_ID_INEXISTENT)
|
||||
return;
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_FORMSPEC_PREPEND, 0, peer_id);
|
||||
pkt << FORMSPEC_VERSION_STRING + player->formspec_prepend;
|
||||
Send(&pkt);
|
||||
}
|
||||
|
||||
u32 Server::SendActiveObjectRemoveAdd(session_t peer_id, const std::string &datas)
|
||||
{
|
||||
NetworkPacket pkt(TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD, datas.size(), peer_id);
|
||||
|
@ -2918,6 +2930,14 @@ void Server::reportInventoryFormspecModified(const std::string &name)
|
|||
SendPlayerInventoryFormspec(player->getPeerId());
|
||||
}
|
||||
|
||||
void Server::reportFormspecPrependModified(const std::string &name)
|
||||
{
|
||||
RemotePlayer *player = m_env->getPlayer(name.c_str());
|
||||
if (!player)
|
||||
return;
|
||||
SendPlayerFormspecPrepend(player->getPeerId());
|
||||
}
|
||||
|
||||
void Server::setIpBanned(const std::string &ip, const std::string &name)
|
||||
{
|
||||
m_banmanager->add(ip, name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue