diff options
author | Wuzzy <wuzzy2@mail.ru> | 2022-01-03 03:14:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-02 22:14:02 -0500 |
commit | 84fdd369d45314a5b7946ff66fe5fce85c1abc1f (patch) | |
tree | dfb478ce40f1c01c777ab4f5779aca4c31ae610b | |
parent | 835524654ed95afd1c5584c398a78ac226d0f27e (diff) | |
download | minetest-84fdd369d45314a5b7946ff66fe5fce85c1abc1f.tar.gz minetest-84fdd369d45314a5b7946ff66fe5fce85c1abc1f.tar.bz2 minetest-84fdd369d45314a5b7946ff66fe5fce85c1abc1f.zip |
Cap damage overlay duration to 1 second (#11871)
-rw-r--r-- | src/client/content_cao.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index db01945eb..9cc40c95f 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -1859,6 +1859,8 @@ void GenericCAO::processMessage(const std::string &data) m_reset_textures_timer = 0.05; if(damage >= 2) m_reset_textures_timer += 0.05 * damage; + // Cap damage overlay to 1 second + m_reset_textures_timer = std::min(m_reset_textures_timer, 1.0f); updateTextures(m_current_texture_modifier + m_prop.damage_texture_modifier); } } @@ -1927,6 +1929,8 @@ bool GenericCAO::directReportPunch(v3f dir, const ItemStack *punchitem, m_reset_textures_timer = 0.05; if (result.damage >= 2) m_reset_textures_timer += 0.05 * result.damage; + // Cap damage overlay to 1 second + m_reset_textures_timer = std::min(m_reset_textures_timer, 1.0f); updateTextures(m_current_texture_modifier + m_prop.damage_texture_modifier); } } |