mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +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
23
src/client.h
23
src/client.h
|
@ -364,6 +364,7 @@ public:
|
|||
void handleCommand_EyeOffset(NetworkPacket* pkt);
|
||||
void handleCommand_UpdatePlayerList(NetworkPacket* pkt);
|
||||
void handleCommand_SrpBytesSandB(NetworkPacket* pkt);
|
||||
void handleCommand_CSMFlavourLimits(NetworkPacket *pkt);
|
||||
|
||||
void ProcessData(NetworkPacket *pkt);
|
||||
|
||||
|
@ -396,6 +397,14 @@ public:
|
|||
|
||||
// Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
|
||||
void removeNode(v3s16 p);
|
||||
|
||||
/**
|
||||
* Helper function for Client Side Modding
|
||||
* Flavour is applied there, this should not be used for core engine
|
||||
* @param p
|
||||
* @param is_valid_position
|
||||
* @return
|
||||
*/
|
||||
MapNode getNode(v3s16 p, bool *is_valid_position);
|
||||
void addNode(v3s16 p, MapNode n, bool remove_metadata = true);
|
||||
|
||||
|
@ -552,6 +561,16 @@ public:
|
|||
return m_address_name;
|
||||
}
|
||||
|
||||
inline bool checkCSMFlavourLimit(CSMFlavourLimit flag) const
|
||||
{
|
||||
return m_csm_flavour_limits & flag;
|
||||
}
|
||||
|
||||
u32 getCSMNodeRangeLimit() const
|
||||
{
|
||||
return m_csm_noderange_limit;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// Virtual methods from con::PeerHandler
|
||||
|
@ -705,6 +724,10 @@ private:
|
|||
GameUIFlags *m_game_ui_flags;
|
||||
|
||||
bool m_shutdown = false;
|
||||
|
||||
// CSM flavour limits byteflag
|
||||
u64 m_csm_flavour_limits = CSMFlavourLimit::CSM_FL_NONE;
|
||||
u32 m_csm_noderange_limit = 8;
|
||||
};
|
||||
|
||||
#endif // !CLIENT_HEADER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue