summaryrefslogtreecommitdiff
path: root/src/script/common/c_content.cpp
diff options
context:
space:
mode:
authorAuke Kok <sofar@foo-projects.org>2017-09-11 14:50:06 +0200
committersfan5 <sfan5@live.de>2017-09-11 20:54:20 +0200
commit5b3fbf9cf75f9f637c666d34e2489fef0cc035d9 (patch)
tree689ae2c108a895f6b2ca3afc826b1da46baf156d /src/script/common/c_content.cpp
parentd10cccee3108b45cf7085ffdbff9b5f2a4045ea7 (diff)
downloadminetest-5b3fbf9cf75f9f637c666d34e2489fef0cc035d9.tar.gz
minetest-5b3fbf9cf75f9f637c666d34e2489fef0cc035d9.tar.bz2
minetest-5b3fbf9cf75f9f637c666d34e2489fef0cc035d9.zip
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.
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r--src/script/common/c_content.cpp6
1 files changed, 6 insertions, 0 deletions
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");
}
/******************************************************************************/