1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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.
This commit is contained in:
Auke Kok 2017-09-11 14:50:06 +02:00 committed by sfan5
parent d10cccee31
commit 5b3fbf9cf7
5 changed files with 33 additions and 1 deletions

View file

@ -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