diff options
author | Lars Müller <34514239+appgurueu@users.noreply.github.com> | 2020-05-11 21:41:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-11 21:41:36 +0200 |
commit | 9ba24f89f5846de6a8f0d7e01c89acfee1254704 (patch) | |
tree | 868e0cee87d50271c4fe088d87aa2cb10a849f7f /src/client/content_cao.cpp | |
parent | 6e1372bd894d955300c40d69e5c882e9cc7d7523 (diff) | |
download | minetest-9ba24f89f5846de6a8f0d7e01c89acfee1254704.tar.gz minetest-9ba24f89f5846de6a8f0d7e01c89acfee1254704.tar.bz2 minetest-9ba24f89f5846de6a8f0d7e01c89acfee1254704.zip |
Damage texture modifier (#9833)
Adds a new object property "damage_texture_modifier"
Diffstat (limited to 'src/client/content_cao.cpp')
-rw-r--r-- | src/client/content_cao.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp index aadd33bb9..eb1dad22b 100644 --- a/src/client/content_cao.cpp +++ b/src/client/content_cao.cpp @@ -1532,7 +1532,7 @@ void GenericCAO::processMessage(const std::string &data) } else if (cmd == AO_CMD_SET_TEXTURE_MOD) { std::string mod = deSerializeString(is); - // immediatly reset a engine issued texture modifier if a mod sends a different one + // immediately reset a engine issued texture modifier if a mod sends a different one if (m_reset_textures_timer > 0) { m_reset_textures_timer = -1; updateTextures(m_previous_texture_modifier); @@ -1646,13 +1646,11 @@ void GenericCAO::processMessage(const std::string &data) m_smgr, m_env, m_position, v2f(m_prop.visual_size.X, m_prop.visual_size.Y) * BS); m_env->addSimpleObject(simple); - } else if (m_reset_textures_timer < 0) { - // TODO: Execute defined fast response - // Flashing shall suffice as there is no definition + } else if (m_reset_textures_timer < 0 && !m_prop.damage_texture_modifier.empty()) { m_reset_textures_timer = 0.05; if(damage >= 2) m_reset_textures_timer += 0.05 * damage; - updateTextures(m_current_texture_modifier + "^[brighten"); + updateTextures(m_current_texture_modifier + m_prop.damage_texture_modifier); } } @@ -1723,13 +1721,11 @@ bool GenericCAO::directReportPunch(v3f dir, const ItemStack *punchitem, v2f(m_prop.visual_size.X, m_prop.visual_size.Y) * BS); m_env->addSimpleObject(simple); } - // TODO: Execute defined fast response - // Flashing shall suffice as there is no definition - if (m_reset_textures_timer < 0) { + if (m_reset_textures_timer < 0 && !m_prop.damage_texture_modifier.empty()) { m_reset_textures_timer = 0.05; if (result.damage >= 2) m_reset_textures_timer += 0.05 * result.damage; - updateTextures(m_current_texture_modifier + "^[brighten"); + updateTextures(m_current_texture_modifier + m_prop.damage_texture_modifier); } } |