mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-31 18:31:04 +00:00
Make hitting players make a visual damage flash to the player texture and the screen of the local player
This commit is contained in:
parent
ae2b7f9523
commit
c357985135
2 changed files with 29 additions and 8 deletions
|
@ -2274,6 +2274,13 @@ public:
|
|||
{
|
||||
pos_translator.translate(dtime);
|
||||
updateNodePos();
|
||||
|
||||
if(m_damage_visual_timer > 0){
|
||||
m_damage_visual_timer -= dtime;
|
||||
if(m_damage_visual_timer <= 0){
|
||||
updateTextures("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void processMessage(const std::string &data)
|
||||
|
@ -2293,6 +2300,17 @@ public:
|
|||
|
||||
updateNodePos();
|
||||
}
|
||||
else if(cmd == 1) // punched
|
||||
{
|
||||
// damage
|
||||
s16 damage = readS16(is);
|
||||
|
||||
if(m_is_local_player)
|
||||
m_env->damageLocalPlayer(damage, false);
|
||||
|
||||
m_damage_visual_timer = 0.5;
|
||||
updateTextures("^[brighten");
|
||||
}
|
||||
}
|
||||
|
||||
void updateTextures(const std::string &mod)
|
||||
|
@ -2318,12 +2336,6 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool directReportPunch(const std::string &toolname, v3f dir)
|
||||
{
|
||||
updateTextures("^[brighten");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Prototype
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue