mirror of
https://github.com/moparisthebest/minetest
synced 2025-01-10 21:28:02 -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,
|
punchitem,
|
||||||
time_from_last_punch);
|
time_from_last_punch);
|
||||||
|
|
||||||
if(result.did_punch)
|
if (result.did_punch) {
|
||||||
{
|
|
||||||
setHP(getHP() - result.damage);
|
setHP(getHP() - result.damage);
|
||||||
|
|
||||||
|
if (result.damage > 0) {
|
||||||
std::string punchername = "nil";
|
std::string punchername = puncher ? puncher->getDescription() : "nil";
|
||||||
|
|
||||||
if ( puncher != 0 )
|
|
||||||
punchername = puncher->getDescription();
|
|
||||||
|
|
||||||
actionstream << getDescription() << " punched by "
|
actionstream << getDescription() << " punched by "
|
||||||
<< punchername << ", damage " << result.damage
|
<< punchername << ", damage " << result.damage
|
||||||
<< " hp, health now " << getHP() << " hp" << std::endl;
|
<< " hp, health now " << getHP() << " hp" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
|
||||||
std::string str = gob_cmd_punched(result.damage, getHP());
|
std::string str = gob_cmd_punched(result.damage, getHP());
|
||||||
// create message and add to list
|
// create message and add to list
|
||||||
ActiveObjectMessage aom(getId(), true, str);
|
ActiveObjectMessage aom(getId(), true, str);
|
||||||
@ -465,7 +461,6 @@ int LuaEntitySAO::punch(v3f dir,
|
|||||||
|
|
||||||
if (getHP() == 0)
|
if (getHP() == 0)
|
||||||
m_removed = true;
|
m_removed = true;
|
||||||
}
|
|
||||||
|
|
||||||
m_env->getScriptIface()->luaentity_Punch(m_id, puncher,
|
m_env->getScriptIface()->luaentity_Punch(m_id, puncher,
|
||||||
time_from_last_punch, toolcap, dir);
|
time_from_last_punch, toolcap, dir);
|
||||||
|
Loading…
Reference in New Issue
Block a user