diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-07-18 21:39:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-18 21:39:55 +0200 |
commit | 79f19b8369a0120fbf0bd0ee3739989fbbbca50e (patch) | |
tree | 0051cde3efe56d35d03aa50a5095d9b8ba04d15b /src/client.cpp | |
parent | 7e3cdf7088b1fb6744d0bd9cc903823b6e3bbfe3 (diff) | |
download | minetest-79f19b8369a0120fbf0bd0ee3739989fbbbca50e.tar.gz minetest-79f19b8369a0120fbf0bd0ee3739989fbbbca50e.tar.bz2 minetest-79f19b8369a0120fbf0bd0ee3739989fbbbca50e.zip |
[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
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp index 443059c36..39bb1e2ff 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1361,8 +1361,22 @@ void Client::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 Client::getNode(v3s16 p, bool *is_valid_position) { + if (checkCSMFlavourLimit(CSMFlavourLimit::CSM_FL_LOOKUP_NODES)) { + v3s16 ppos = floatToInt(m_env.getLocalPlayer()->getPosition(), BS); + if ((u32) ppos.getDistanceFrom(p) > m_csm_noderange_limit) { + *is_valid_position = false; + return MapNode(); + } + } return m_env.getMap().getNodeNoEx(p, is_valid_position); } |