aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorsavilli <78875209+savilli@users.noreply.github.com>2021-08-28 12:14:16 +0200
committerGitHub <noreply@github.com>2021-08-28 12:14:16 +0200
commit3f1adb49ae8da5bb02bea52609524d3645b6a665 (patch)
tree43bebf8149ef9f83a1d3c79579e7ba6453e414ab /src/script
parent1d69a23ba48d99b051dcf2a6be225edd7c644c7b (diff)
downloadminetest-3f1adb49ae8da5bb02bea52609524d3645b6a665.tar.gz
minetest-3f1adb49ae8da5bb02bea52609524d3645b6a665.tar.bz2
minetest-3f1adb49ae8da5bb02bea52609524d3645b6a665.zip
Remove redundant on_dieplayer calls
Diffstat (limited to 'src/script')
-rw-r--r--src/script/common/c_content.cpp2
-rw-r--r--src/script/lua_api/l_object.cpp18
2 files changed, 0 insertions, 20 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index f13287375..5a095fd8f 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -200,8 +200,6 @@ void read_object_properties(lua_State *L, int index,
if (prop->hp_max < sao->getHP()) {
PlayerHPChangeReason reason(PlayerHPChangeReason::SET_HP);
sao->setHP(prop->hp_max, reason);
- if (sao->getType() == ACTIVEOBJECT_TYPE_PLAYER)
- sao->getEnv()->getGameDef()->SendPlayerHPOrDie((PlayerSAO *)sao, reason);
}
}
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index c8fa7d806..b7185f7ec 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -172,27 +172,11 @@ int ObjectRef::l_punch(lua_State *L)
float time_from_last_punch = readParam<float>(L, 3, 1000000.0f);
ToolCapabilities toolcap = read_tool_capabilities(L, 4);
v3f dir = readParam<v3f>(L, 5, sao->getBasePosition() - puncher->getBasePosition());
-
dir.normalize();
- u16 src_original_hp = sao->getHP();
- u16 dst_origin_hp = puncher->getHP();
u16 wear = sao->punch(dir, &toolcap, puncher, time_from_last_punch);
lua_pushnumber(L, wear);
- // If the punched is a player, and its HP changed
- if (src_original_hp != sao->getHP() &&
- sao->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
- getServer(L)->SendPlayerHPOrDie((PlayerSAO *)sao,
- PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, puncher));
- }
-
- // 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,
- PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, sao));
- }
return 1;
}
@@ -238,8 +222,6 @@ int ObjectRef::l_set_hp(lua_State *L)
}
sao->setHP(hp, reason);
- if (sao->getType() == ACTIVEOBJECT_TYPE_PLAYER)
- getServer(L)->SendPlayerHPOrDie((PlayerSAO *)sao, reason);
if (reason.hasLuaReference())
luaL_unref(L, LUA_REGISTRYINDEX, reason.lua_reference);
return 0;