mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Add reasons to on_dieplayer and on_hpchange
This commit is contained in:
parent
2323842dd3
commit
dfc8198349
14 changed files with 219 additions and 52 deletions
|
@ -812,8 +812,9 @@ void Server::handleCommand_Damage(NetworkPacket* pkt)
|
|||
<< (int)damage << " hp at " << PP(playersao->getBasePosition() / BS)
|
||||
<< std::endl;
|
||||
|
||||
playersao->setHP(playersao->getHP() - damage);
|
||||
SendPlayerHPOrDie(playersao);
|
||||
PlayerHPChangeReason reason(PlayerHPChangeReason::FALL);
|
||||
playersao->setHP(playersao->getHP() - damage, reason);
|
||||
SendPlayerHPOrDie(playersao, reason);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1175,12 +1176,14 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
|
|||
// If the object is a player and its HP changed
|
||||
if (src_original_hp != pointed_object->getHP() &&
|
||||
pointed_object->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
|
||||
SendPlayerHPOrDie((PlayerSAO *)pointed_object);
|
||||
SendPlayerHPOrDie((PlayerSAO *)pointed_object,
|
||||
PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, playersao));
|
||||
}
|
||||
|
||||
// If the puncher is a player and its HP changed
|
||||
if (dst_origin_hp != playersao->getHP())
|
||||
SendPlayerHPOrDie(playersao);
|
||||
SendPlayerHPOrDie(playersao,
|
||||
PlayerHPChangeReason(PlayerHPChangeReason::PLAYER_PUNCH, pointed_object));
|
||||
}
|
||||
|
||||
} // action == 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue