aboutsummaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2021-10-01 14:21:24 +0000
committerGitHub <noreply@github.com>2021-10-01 16:21:24 +0200
commit21113ad4105dd3fb181b3d0638b907af94a352ab (patch)
tree9cd1346f6aff8968c23e2447e50d4469b888b01b /src/nodedef.cpp
parentf5040707fe7cf9f24274379598527d6298c5818c (diff)
downloadminetest-21113ad4105dd3fb181b3d0638b907af94a352ab.tar.gz
minetest-21113ad4105dd3fb181b3d0638b907af94a352ab.tar.bz2
minetest-21113ad4105dd3fb181b3d0638b907af94a352ab.zip
Split liquid_viscosity to liquid_viscosity and move_resistance (#10810)
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r--src/nodedef.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index db4043aa1..703df4dee 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -403,6 +403,8 @@ void ContentFeatures::reset()
palette_name = "";
palette = NULL;
node_dig_prediction = "air";
+ move_resistance = 0;
+ liquid_move_physics = false;
}
void ContentFeatures::setAlphaFromLegacy(u8 legacy_alpha)
@@ -512,9 +514,12 @@ void ContentFeatures::serialize(std::ostream &os, u16 protocol_version) const
writeU8(os, legacy_facedir_simple);
writeU8(os, legacy_wallmounted);
+ // new attributes
os << serializeString16(node_dig_prediction);
writeU8(os, leveled_max);
writeU8(os, alpha);
+ writeU8(os, move_resistance);
+ writeU8(os, liquid_move_physics);
}
void ContentFeatures::deSerialize(std::istream &is)
@@ -584,9 +589,11 @@ void ContentFeatures::deSerialize(std::istream &is)
// liquid
liquid_type = (enum LiquidType) readU8(is);
+ liquid_move_physics = liquid_type != LIQUID_NONE;
liquid_alternative_flowing = deSerializeString16(is);
liquid_alternative_source = deSerializeString16(is);
liquid_viscosity = readU8(is);
+ move_resistance = liquid_viscosity; // set default move_resistance
liquid_renewable = readU8(is);
liquid_range = readU8(is);
drowning = readU8(is);
@@ -618,6 +625,16 @@ void ContentFeatures::deSerialize(std::istream &is)
if (is.eof())
throw SerializationError("");
alpha = static_cast<enum AlphaMode>(tmp);
+
+ tmp = readU8(is);
+ if (is.eof())
+ throw SerializationError("");
+ move_resistance = tmp;
+
+ tmp = readU8(is);
+ if (is.eof())
+ throw SerializationError("");
+ liquid_move_physics = tmp;
} catch(SerializationError &e) {};
}