mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix damage flash when damage disabled
This commit is contained in:
parent
8eb272cea3
commit
1a1774a105
4 changed files with 25 additions and 15 deletions
|
@ -222,15 +222,13 @@ int ObjectRef::l_punch(lua_State *L)
|
|||
// If the punched is a player, and its HP changed
|
||||
if (src_original_hp != co->getHP() &&
|
||||
co->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
|
||||
getServer(L)->SendPlayerHPOrDie(((PlayerSAO*)co)->getPeerID(),
|
||||
co->getHP() == 0);
|
||||
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co);
|
||||
}
|
||||
|
||||
// If the puncher is a player, and its HP changed
|
||||
if (dst_origin_hp != puncher->getHP() &&
|
||||
puncher->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
|
||||
getServer(L)->SendPlayerHPOrDie(((PlayerSAO*)puncher)->getPeerID(),
|
||||
puncher->getHP() == 0);
|
||||
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)puncher);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -265,9 +263,9 @@ int ObjectRef::l_set_hp(lua_State *L)
|
|||
<<" hp="<<hp<<std::endl;*/
|
||||
// Do it
|
||||
co->setHP(hp);
|
||||
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
|
||||
getServer(L)->SendPlayerHPOrDie(((PlayerSAO*)co)->getPeerID(), co->getHP() == 0);
|
||||
}
|
||||
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER)
|
||||
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co);
|
||||
|
||||
// Return
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue