From 5b3fbf9cf75f9f637c666d34e2489fef0cc035d9 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 11 Sep 2017 14:50:06 +0200 Subject: Implement client node dig prediction Dig prediction allows clients to remove dug nodes without waiting for server acknowledgement. This patch allows mods to override dig prediction, it can either be turned off or a different "prediction node" can be selected. --- src/script/common/c_content.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/script/common') diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 9e1fed2f1..ad92741f8 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -737,6 +737,10 @@ ContentFeatures read_content_features(lua_State *L, int index) } lua_pop(L, 1); + // Node immediately placed by client when node is dug + getstringfield(L, index, "node_dig_prediction", + f.node_dig_prediction); + return f; } @@ -861,6 +865,8 @@ void push_content_features(lua_State *L, const ContentFeatures &c) lua_setfield(L, -2, "legacy_facedir_simple"); lua_pushboolean(L, c.legacy_wallmounted); lua_setfield(L, -2, "legacy_wallmounted"); + lua_pushstring(L, c.node_dig_prediction.c_str()); + lua_setfield(L, -2, "node_dig_prediction"); } /******************************************************************************/ -- cgit v1.2.3