mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-23 15:05:29 +01:00
Add more information in PlayerHPChangeReason (#16024)
1) Add `node` and `node_pos` field for the `drown` field (analog to `node_damage` type) 2) Add `custom_type` field to allow a standardized way to report more details of the HP change 3) Make `builtin` report a `custom_type` for the HP changes caused by the `/kill` command and `core.do_item_eat` 4) Move the documentation of `PlayerHPChangeReason` to its own section 5) Fill in missing information of said documentation
This commit is contained in:
@@ -159,7 +159,8 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
||||
|
||||
// No more breath, damage player
|
||||
if (m_breath == 0) {
|
||||
PlayerHPChangeReason reason(PlayerHPChangeReason::DROWNING);
|
||||
std::string nodename = c.name;
|
||||
PlayerHPChangeReason reason(PlayerHPChangeReason::DROWNING, nodename, p);
|
||||
setHP(m_hp - c.drowning, reason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ struct PlayerHPChangeReason
|
||||
|
||||
// For PLAYER_PUNCH
|
||||
ServerActiveObject *object = nullptr;
|
||||
// For NODE_DAMAGE
|
||||
// For NODE_DAMAGE and DROWNING
|
||||
std::string node;
|
||||
v3s16 node_pos;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user