Ignore punches with no damage in the actionstream

master
SmallJoker 2015-03-11 20:52:47 +01:00 committed by est31
parent ecdfbfc8dc
commit bb5f830d16
1 changed files with 18 additions and 23 deletions

View File

@ -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);