aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2019-09-22 22:12:21 +0200
committerGitHub <noreply@github.com>2019-09-22 22:12:21 +0200
commit70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9 (patch)
tree7ae4b3532d6f7aee52b3c2c16628fe82c88775fa /src/script/lua_api
parentfec30e37ac1d160a942777b05a7717b5395c4d99 (diff)
downloadminetest-70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9.tar.gz
minetest-70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9.tar.bz2
minetest-70f9e1aafa6cd7a2b2d204609cab6cc26539cdb9.zip
Punchwear (improved) (#8959)
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_object.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 22445fc9a..efdb345c9 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -187,7 +187,8 @@ int ObjectRef::l_punch(lua_State *L)
u16 dst_origin_hp = puncher->getHP();
// Do it
- co->punch(dir, &toolcap, puncher, time_from_last_punch);
+ u16 wear = co->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 != co->getHP() &&
@@ -202,7 +203,7 @@ int ObjectRef::l_punch(lua_State *L)
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)puncher,
PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, co));
}
- return 0;
+ return 1;
}
// right_click(self, clicker); clicker = an another ObjectRef