aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--games/devtest/mods/testnodes/properties.lua4
-rw-r--r--src/collision.cpp3
-rw-r--r--src/nodedef.cpp7
3 files changed, 10 insertions, 4 deletions
diff --git a/games/devtest/mods/testnodes/properties.lua b/games/devtest/mods/testnodes/properties.lua
index 51f703d7c..89facf71c 100644
--- a/games/devtest/mods/testnodes/properties.lua
+++ b/games/devtest/mods/testnodes/properties.lua
@@ -252,9 +252,9 @@ for i=-100, 100, 25 do
end
-- Bouncy nodes (various bounce levels)
-for i=20, 180, 20 do
+for i=-140, 180, 20 do
local val = math.floor(((i-20)/200)*255)
- minetest.register_node("testnodes:bouncy"..i, {
+ minetest.register_node(("testnodes:bouncy"..i):gsub("-","NEG"), {
description = S("Bouncy Node (@1%)", i),
groups = {bouncy=i, dig_immediate=3},
diff --git a/src/collision.cpp b/src/collision.cpp
index d85a56884..ccc3a058d 100644
--- a/src/collision.cpp
+++ b/src/collision.cpp
@@ -303,7 +303,8 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
if (!f.walkable)
continue;
- int n_bouncy_value = itemgroup_get(f.groups, "bouncy");
+ // Negative bouncy may have a meaning, but we need +value here.
+ int n_bouncy_value = abs(itemgroup_get(f.groups, "bouncy"));
int neighbors = 0;
if (f.drawtype == NDT_NODEBOX &&
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);