mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Punchwear (improved) (#8959)
This commit is contained in:
parent
fec30e37ac
commit
70f9e1aafa
10 changed files with 73 additions and 31 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue