mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
[CSM] Add flavour limits controlled by server (#5930)
* [CSM] Add flavour limits controlled by server Server send flavour limits to client permitting to disable or limit some Lua calls * Add limits for reading nodedefs and itemdefs * flavour: Add lookup node limits * Merge get_node_or_nil into get_node. Sending fake node doesn't make sense in CSM, just return nil if node is not available for any reason * Add node range customization when noderange flavour is enabled (default 8 nodes) * Limit nodes range & disable chat message sending by default * Bump protocol version
This commit is contained in:
parent
7e3cdf7088
commit
79f19b8369
18 changed files with 136 additions and 29 deletions
|
@ -298,6 +298,8 @@ Server::Server(
|
|||
|
||||
m_liquid_transform_every = g_settings->getFloat("liquid_update");
|
||||
m_max_chatmessage_length = g_settings->getU16("chat_message_max_size");
|
||||
m_csm_flavour_limits = g_settings->getU64("csm_flavour_limits");
|
||||
m_csm_noderange_limit = g_settings->getU32("csm_flavour_noderange_limit");
|
||||
}
|
||||
|
||||
Server::~Server()
|
||||
|
@ -2017,7 +2019,14 @@ void Server::SendActiveObjectMessages(u16 peer_id, const std::string &datas, boo
|
|||
m_clients.send(pkt.getPeerId(),
|
||||
reliable ? clientCommandFactoryTable[pkt.getCommand()].channel : 1,
|
||||
&pkt, reliable);
|
||||
}
|
||||
|
||||
void Server::SendCSMFlavourLimits(u16 peer_id)
|
||||
{
|
||||
NetworkPacket pkt(TOCLIENT_CSM_FLAVOUR_LIMITS,
|
||||
sizeof(m_csm_flavour_limits) + sizeof(m_csm_noderange_limit), peer_id);
|
||||
pkt << m_csm_flavour_limits << m_csm_noderange_limit;
|
||||
Send(&pkt);
|
||||
}
|
||||
|
||||
s32 Server::playSound(const SimpleSoundSpec &spec,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue