mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add node field to PlayerHPChangeReason table (#8368)
This commit is contained in:
parent
1e5f2e0f13
commit
22ad820aa4
5 changed files with 39 additions and 14 deletions
|
@ -170,8 +170,8 @@ int ObjectRef::l_punch(lua_State *L)
|
|||
ObjectRef *puncher_ref = checkobject(L, 2);
|
||||
ServerActiveObject *co = getobject(ref);
|
||||
ServerActiveObject *puncher = getobject(puncher_ref);
|
||||
if (co == NULL) return 0;
|
||||
if (puncher == NULL) return 0;
|
||||
if (!co || !puncher)
|
||||
return 0;
|
||||
v3f dir;
|
||||
if (lua_type(L, 5) != LUA_TTABLE)
|
||||
dir = co->getBasePosition() - puncher->getBasePosition();
|
||||
|
@ -192,7 +192,8 @@ int ObjectRef::l_punch(lua_State *L)
|
|||
// If the punched is a player, and its HP changed
|
||||
if (src_original_hp != co->getHP() &&
|
||||
co->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
|
||||
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co, PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, puncher));
|
||||
getServer(L)->SendPlayerHPOrDie((PlayerSAO *)co,
|
||||
PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, puncher));
|
||||
}
|
||||
|
||||
// If the puncher is a player, and its HP changed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue