aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-07-10 15:58:32 -0400
committerkwolekr <kwolekr@minetest.net>2015-07-10 15:58:57 -0400
commit1a1774a1051790ef85b1bd8b047ac45a3676b5d6 (patch)
treeb5e0083230d80960f43c7eed3ea5787e92976ae1 /src/script/lua_api/l_object.cpp
parent8eb272cea38325f963c521ecfa7b927a563f8509 (diff)
downloadminetest-1a1774a1051790ef85b1bd8b047ac45a3676b5d6.tar.gz
minetest-1a1774a1051790ef85b1bd8b047ac45a3676b5d6.tar.bz2
minetest-1a1774a1051790ef85b1bd8b047ac45a3676b5d6.zip
Fix damage flash when damage disabled
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;
}