mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-22 23:58:48 -05:00
Ignore punches with no damage in the actionstream
This commit is contained in:
parent
ecdfbfc8dc
commit
bb5f830d16
@ -442,21 +442,17 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
punchitem,
|
||||
time_from_last_punch);
|
||||
|
||||
if(result.did_punch)
|
||||
{
|
||||
if (result.did_punch) {
|
||||
setHP(getHP() - result.damage);
|
||||
|
||||
|
||||
std::string punchername = "nil";
|
||||
|
||||
if ( puncher != 0 )
|
||||
punchername = puncher->getDescription();
|
||||
if (result.damage > 0) {
|
||||
std::string punchername = puncher ? puncher->getDescription() : "nil";
|
||||
|
||||
actionstream << getDescription() << " punched by "
|
||||
<< punchername << ", damage " << result.damage
|
||||
<< " hp, health now " << getHP() << " hp" << std::endl;
|
||||
}
|
||||
|
||||
{
|
||||
std::string str = gob_cmd_punched(result.damage, getHP());
|
||||
// create message and add to list
|
||||
ActiveObjectMessage aom(getId(), true, str);
|
||||
@ -465,7 +461,6 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
|
||||
if (getHP() == 0)
|
||||
m_removed = true;
|
||||
}
|
||||
|
||||
m_env->getScriptIface()->luaentity_Punch(m_id, puncher,
|
||||
time_from_last_punch, toolcap, dir);
|
||||
|
Loading…
Reference in New Issue
Block a user