aboutsummaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
diff options
context:
space:
mode:
authorpecksin <78765996+pecksin@users.noreply.github.com>2022-02-16 17:06:00 -0500
committerGitHub <noreply@github.com>2022-02-16 17:06:00 -0500
commit5d0b18a0d0bd02a9b77b8948d6887bb661a385da (patch)
treea510f83ee2e0cc78687a9009d127505a41bc2d62 /src/nodedef.cpp
parent258ae994915e1b9fc5b3a72627886f2ce4334902 (diff)
downloaddragonfireclient-5d0b18a0d0bd02a9b77b8948d6887bb661a385da.tar.xz
Use absolute value for bouncy in collision (#11969)
* use abs(bouncy) in collision * test case for negative bouncy * send abs(bouncy) to old clients
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r--src/nodedef.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 8a5542837..fe0cc4bb0 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -452,7 +452,12 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) const
writeU16(os, groups.size());
for (const auto &group : groups) {
os << serializeString16(group.first);
- writeS16(os, group.second);
+ if (protocol_version < 41 && group.first.compare("bouncy") == 0) {
+ // Old clients may choke on negative bouncy value
+ writeS16(os, abs(group.second));
+ } else {
+ writeS16(os, group.second);
+ }
}
writeU8(os, param_type);
writeU8(os, param_type_2);