mirror of
https://github.com/minetest/minetest.git
synced 2025-01-11 15:57:29 +01:00
Cap damage overlay duration to 1 second (#11871)
This commit is contained in:
parent
835524654e
commit
84fdd369d4
@ -1859,6 +1859,8 @@ void GenericCAO::processMessage(const std::string &data)
|
|||||||
m_reset_textures_timer = 0.05;
|
m_reset_textures_timer = 0.05;
|
||||||
if(damage >= 2)
|
if(damage >= 2)
|
||||||
m_reset_textures_timer += 0.05 * damage;
|
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);
|
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;
|
m_reset_textures_timer = 0.05;
|
||||||
if (result.damage >= 2)
|
if (result.damage >= 2)
|
||||||
m_reset_textures_timer += 0.05 * result.damage;
|
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);
|
updateTextures(m_current_texture_modifier + m_prop.damage_texture_modifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user