summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-03-22 18:01:56 +0100
committerLoic Blot <loic.blot@unix-experience.fr>2015-03-22 18:01:56 +0100
commit008d7e0467a30f78e0c1a707be0c34aaa884732c (patch)
tree53e90fc4eca8585e473b8a459100362f3ba45fd3 /src/script/lua_api/l_object.cpp
parent61f2d0ca3417b2a18a60015bf5423629d81bb754 (diff)
downloadminetest-008d7e0467a30f78e0c1a707be0c34aaa884732c.tar.gz
minetest-008d7e0467a30f78e0c1a707be0c34aaa884732c.tar.bz2
minetest-008d7e0467a30f78e0c1a707be0c34aaa884732c.zip
Revert "Add a Lua call to do damages / heals" ok @ShadowNinja
This reverts commit 467fc0ddc912ae38c3bf9fcb99e0b66d7478eec0.
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp41
1 files changed, 3 insertions, 38 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 079558c51..d8cfaf82b 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -29,8 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_sao.h"
#include "server.h"
#include "hud.h"
-#include "settings.h"
-#include "main.h"
struct EnumString es_HudElementType[] =
@@ -257,10 +255,10 @@ int ObjectRef::l_set_hp(lua_State *L)
ObjectRef *ref = checkobject(L, 1);
luaL_checknumber(L, 2);
ServerActiveObject *co = getobject(ref);
- if(co == NULL)
- return 0;
+ if(co == NULL) return 0;
int hp = lua_tonumber(L, 2);
-
+ /*infostream<<"ObjectRef::l_set_hp(): id="<<co->getId()
+ <<" hp="<<hp<<std::endl;*/
// Do it
co->setHP(hp);
if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
@@ -291,38 +289,6 @@ int ObjectRef::l_get_hp(lua_State *L)
return 1;
}
-// apply_damage(self, damage)
-// damage = amount of damage to apply
-// if damage is negative, heal the player
-// returns: nil
-int ObjectRef::l_apply_damage(lua_State *L)
-{
- NO_MAP_LOCK_REQUIRED;
- ObjectRef *ref = checkobject(L, 1);
- luaL_checknumber(L, 2);
- ServerActiveObject *co = getobject(ref);
- if(co == NULL)
- return 0;
-
- int damage = lua_tonumber(L, 2);
-
- // No damage, no heal => do nothing
- if (damage == 0)
- return 0;
-
- // If damage is positive (not healing) and damage is disabled, ignore
- if (damage > 0 && g_settings->getBool("enable_damage") == false)
- return 0;
-
- // Do damage/heal
- co->setHP(co->getHP() - damage);
- if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
- getServer(L)->SendPlayerHPOrDie(((PlayerSAO*)co)->getPeerID(), co->getHP() == 0);
- }
-
- return 0;
-}
-
// get_inventory(self)
int ObjectRef::l_get_inventory(lua_State *L)
{
@@ -1379,7 +1345,6 @@ const luaL_reg ObjectRef::methods[] = {
luamethod(ObjectRef, right_click),
luamethod(ObjectRef, set_hp),
luamethod(ObjectRef, get_hp),
- luamethod(ObjectRef, apply_damage),
luamethod(ObjectRef, get_inventory),
luamethod(ObjectRef, get_wield_list),
luamethod(ObjectRef, get_wield_index),