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/nodedef.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nodedef.cpp') diff --git a/src/nodedef.cpp b/src/nodedef.cpp index bc03b71e7..e547e31b1 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -335,6 +335,7 @@ void ContentFeatures::reset() color = video::SColor(0xFFFFFFFF); palette_name = ""; palette = NULL; + node_dig_prediction = "air"; } void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) const @@ -422,6 +423,8 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) const // legacy writeU8(os, legacy_facedir_simple); writeU8(os, legacy_wallmounted); + + os << serializeString(node_dig_prediction); } void ContentFeatures::correctAlpha(TileDef *tiles, int length) @@ -530,6 +533,10 @@ void ContentFeatures::deSerialize(std::istream &is) // read legacy properties legacy_facedir_simple = readU8(is); legacy_wallmounted = readU8(is); + + try { + node_dig_prediction = deSerializeString(is); + } catch(SerializationError &e) {}; } #ifndef SERVER -- cgit v1.2.3