mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-12 16:58:39 +00:00
Allow nil as puncher e.g. to do damage by tnt
This commit is contained in:
parent
3e2efdf18a
commit
55a97f4605
2 changed files with 29 additions and 9 deletions
|
@ -673,8 +673,14 @@ int LuaEntitySAO::punch(v3f dir,
|
|||
{
|
||||
setHP(getHP() - result.damage);
|
||||
|
||||
|
||||
std::string punchername = "nil";
|
||||
|
||||
if ( puncher != 0 )
|
||||
punchername = puncher->getDescription();
|
||||
|
||||
actionstream<<getDescription()<<" punched by "
|
||||
<<puncher->getDescription()<<", damage "<<result.damage
|
||||
<<punchername<<", damage "<<result.damage
|
||||
<<" hp, health now "<<getHP()<<" hp"<<std::endl;
|
||||
|
||||
{
|
||||
|
@ -1307,8 +1313,13 @@ int PlayerSAO::punch(v3f dir,
|
|||
HitParams hitparams = getHitParams(m_armor_groups, toolcap,
|
||||
time_from_last_punch);
|
||||
|
||||
std::string punchername = "nil";
|
||||
|
||||
if ( puncher != 0 )
|
||||
punchername = puncher->getDescription();
|
||||
|
||||
actionstream<<"Player "<<m_player->getName()<<" punched by "
|
||||
<<puncher->getDescription()<<", damage "<<hitparams.hp
|
||||
<<punchername<<", damage "<<hitparams.hp
|
||||
<<" HP"<<std::endl;
|
||||
|
||||
setHP(getHP() - hitparams.hp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue