1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 08:35:20 +02:00

Fix damage flash when damage disabled

This commit is contained in:
kwolekr
2015-07-10 15:58:32 -04:00
parent 8eb272cea3
commit 1a1774a105
4 changed files with 25 additions and 15 deletions

View File

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