@@ -29,8 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
29
29
#include " content_sao.h"
30
30
#include " server.h"
31
31
#include " hud.h"
32
- #include " settings.h"
33
- #include " main.h"
34
32
35
33
36
34
struct EnumString es_HudElementType[] =
@@ -257,10 +255,10 @@ int ObjectRef::l_set_hp(lua_State *L)
257
255
ObjectRef *ref = checkobject (L, 1 );
258
256
luaL_checknumber (L, 2 );
259
257
ServerActiveObject *co = getobject (ref);
260
- if (co == NULL )
261
- return 0 ;
258
+ if (co == NULL ) return 0 ;
262
259
int hp = lua_tonumber (L, 2 );
263
-
260
+ /* infostream<<"ObjectRef::l_set_hp(): id="<<co->getId()
261
+ <<" hp="<<hp<<std::endl;*/
264
262
// Do it
265
263
co->setHP (hp);
266
264
if (co->getType () == ACTIVEOBJECT_TYPE_PLAYER) {
@@ -291,38 +289,6 @@ int ObjectRef::l_get_hp(lua_State *L)
291
289
return 1 ;
292
290
}
293
291
294
- // apply_damage(self, damage)
295
- // damage = amount of damage to apply
296
- // if damage is negative, heal the player
297
- // returns: nil
298
- int ObjectRef::l_apply_damage (lua_State *L)
299
- {
300
- NO_MAP_LOCK_REQUIRED;
301
- ObjectRef *ref = checkobject (L, 1 );
302
- luaL_checknumber (L, 2 );
303
- ServerActiveObject *co = getobject (ref);
304
- if (co == NULL )
305
- return 0 ;
306
-
307
- int damage = lua_tonumber (L, 2 );
308
-
309
- // No damage, no heal => do nothing
310
- if (damage == 0 )
311
- return 0 ;
312
-
313
- // If damage is positive (not healing) and damage is disabled, ignore
314
- if (damage > 0 && g_settings->getBool (" enable_damage" ) == false )
315
- return 0 ;
316
-
317
- // Do damage/heal
318
- co->setHP (co->getHP () - damage);
319
- if (co->getType () == ACTIVEOBJECT_TYPE_PLAYER) {
320
- getServer (L)->SendPlayerHPOrDie (((PlayerSAO*)co)->getPeerID (), co->getHP () == 0 );
321
- }
322
-
323
- return 0 ;
324
- }
325
-
326
292
// get_inventory(self)
327
293
int ObjectRef::l_get_inventory (lua_State *L)
328
294
{
@@ -1379,7 +1345,6 @@ const luaL_reg ObjectRef::methods[] = {
1379
1345
luamethod (ObjectRef, right_click),
1380
1346
luamethod (ObjectRef, set_hp),
1381
1347
luamethod (ObjectRef, get_hp),
1382
- luamethod (ObjectRef, apply_damage),
1383
1348
luamethod (ObjectRef, get_inventory),
1384
1349
luamethod (ObjectRef, get_wield_list),
1385
1350
luamethod (ObjectRef, get_wield_index),
0 commit comments