mirror of
https://github.com/minetest/minetest.git
synced 2025-01-07 05:47:29 +01:00
Use absolute value for bouncy in collision (#11969)
[backport: removed devtest change and protocol_version comparison]
This commit is contained in:
parent
25373ad294
commit
62ad2c3bc1
@ -303,7 +303,8 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
|||||||
if (!f.walkable)
|
if (!f.walkable)
|
||||||
continue;
|
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;
|
int neighbors = 0;
|
||||||
if (f.drawtype == NDT_NODEBOX &&
|
if (f.drawtype == NDT_NODEBOX &&
|
||||||
|
@ -452,7 +452,12 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) const
|
|||||||
writeU16(os, groups.size());
|
writeU16(os, groups.size());
|
||||||
for (const auto &group : groups) {
|
for (const auto &group : groups) {
|
||||||
os << serializeString16(group.first);
|
os << serializeString16(group.first);
|
||||||
writeS16(os, group.second);
|
if (group.first.compare("bouncy") == 0) {
|
||||||
|
// 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);
|
||||||
writeU8(os, param_type_2);
|
writeU8(os, param_type_2);
|
||||||
|
Loading…
Reference in New Issue
Block a user