1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 08:35:20 +02:00

Punchwear (improved) (#8959)

This commit is contained in:
sfan5
2019-09-22 22:12:21 +02:00
committed by GitHub
parent fec30e37ac
commit 70f9e1aafa
10 changed files with 73 additions and 31 deletions

View File

@@ -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