summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 4b1cc39fb..e407ef162 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -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;
}