aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-06-10 16:53:23 +0200
committersfan5 <sfan5@live.de>2020-06-11 21:12:36 +0200
commitf89794108c49a7a9e992afb9431ae244e4a4fef1 (patch)
treed3690884ecc9f24d39c783ab89cce6b685c49134 /src/client
parent80d9e9c1834fdc78588ffe2842766c0177227786 (diff)
downloadminetest-f89794108c49a7a9e992afb9431ae244e4a4fef1.tar.gz
minetest-f89794108c49a7a9e992afb9431ae244e4a4fef1.tar.bz2
minetest-f89794108c49a7a9e992afb9431ae244e4a4fef1.zip
content_cao: Do not expire visuals for texture updates
Diffstat (limited to 'src/client')
-rw-r--r--src/client/content_cao.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index 79ecccb6f..644a71e6e 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -1487,18 +1487,22 @@ void GenericCAO::updateAttachments()
bool GenericCAO::visualExpiryRequired(const ObjectProperties &new_) const
{
const ObjectProperties &old = m_prop;
+ /* Visuals do not need to be expired for:
+ * - nametag props: handled by updateNametag()
+ * - textures: handled by updateTextures()
+ * - sprite props: handled by updateTexturePos()
+ * - glow: handled by updateLight()
+ * - any other properties that do not change appearance
+ */
// Ordered to compare primitive types before std::vectors
return old.backface_culling != new_.backface_culling ||
- old.initial_sprite_basepos != new_.initial_sprite_basepos ||
old.is_visible != new_.is_visible ||
old.mesh != new_.mesh ||
- old.spritediv != new_.spritediv ||
old.use_texture_alpha != new_.use_texture_alpha ||
old.visual != new_.visual ||
old.visual_size != new_.visual_size ||
old.wield_item != new_.wield_item ||
- old.colors != new_.colors ||
- old.textures != new_.textures;
+ old.colors != new_.colors;
}
void GenericCAO::processMessage(const std::string &data)
@@ -1513,6 +1517,7 @@ void GenericCAO::processMessage(const std::string &data)
// Check what exactly changed
bool expire_visuals = visualExpiryRequired(newprops);
+ bool textures_changed = m_prop.textures != newprops.textures;
// Apply changes
m_prop = std::move(newprops);
@@ -1541,13 +1546,18 @@ void GenericCAO::processMessage(const std::string &data)
if ((m_is_player && !m_is_local_player) && m_prop.nametag.empty())
m_prop.nametag = m_name;
- updateNametag();
if (expire_visuals) {
expireVisuals();
} else {
infostream << "GenericCAO: properties updated but expiring visuals"
<< " not necessary" << std::endl;
+ if (textures_changed) {
+ // don't update while punch texture modifier is active
+ if (m_reset_textures_timer < 0)
+ updateTextures(m_current_texture_modifier);
+ }
+ updateNametag();
}
} else if (cmd == AO_CMD_UPDATE_POSITION) {
// Not sent by the server if this object is an attachment.