Skip to content

Commit

Permalink
Cap damage overlay duration to 1 second (#11871)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuzzy2 committed Jan 3, 2022
1 parent 8355246 commit 84fdd36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/client/content_cao.cpp
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 84fdd36

Please sign in to comment.