Don't add damage flash while punch texture modifier is active (#5767)
authorstujones11 <stujones111@gmail.com>
Mon, 29 May 2017 21:26:25 +0000 (22:26 +0100)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Mon, 29 May 2017 21:26:25 +0000 (23:26 +0200)
src/content_cao.cpp

index 5690ecf1ebda041f35230093c91ed6291c555374..d15c53e7a36185ed60f53dc00b3c11dbe5a316e9 100644 (file)
@@ -1735,7 +1735,7 @@ void GenericCAO::processMessage(const std::string &data)
                                                m_smgr, m_env, m_position,
                                                m_prop.visual_size * BS);
                                m_env->addSimpleObject(simple);
-                       } else {
+                       } else if (m_reset_textures_timer < 0) {
                                // TODO: Execute defined fast response
                                // Flashing shall suffice as there is no definition
                                m_reset_textures_timer = 0.05;
@@ -1806,10 +1806,12 @@ bool GenericCAO::directReportPunch(v3f dir, const ItemStack *punchitem,
                }
                // TODO: Execute defined fast response
                // Flashing shall suffice as there is no definition
-               m_reset_textures_timer = 0.05;
-               if(result.damage >= 2)
-                       m_reset_textures_timer += 0.05 * result.damage;
-               updateTextures(m_current_texture_modifier + "^[brighten");
+               if (m_reset_textures_timer < 0) {
+                       m_reset_textures_timer = 0.05;
+                       if (result.damage >= 2)
+                               m_reset_textures_timer += 0.05 * result.damage;
+                       updateTextures(m_current_texture_modifier + "^[brighten");
+               }
        }
 
        return false;