mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Report node for drowning in PlayerHPChangeReason
This commit is contained in:
parent
6d3057b08e
commit
a21dd0a992
3 changed files with 5 additions and 3 deletions
|
@ -11086,7 +11086,8 @@ The `PlayerHPChangeReason` table specifies a reason for player health changes.
|
||||||
* `node_damage`: `damage_per_second` from a neighboring node.
|
* `node_damage`: `damage_per_second` from a neighboring node.
|
||||||
`reason.node` will hold the node name or nil.
|
`reason.node` will hold the node name or nil.
|
||||||
`reason.node_pos` will hold the position of the node
|
`reason.node_pos` will hold the position of the node
|
||||||
* `drown`: Drowning damage.
|
* `drown`: Drowning damage from a node with the `drowning` field set.
|
||||||
|
`reason.node` and `reason.node_pos` are same as for `node_damage`
|
||||||
* `respawn`: HP restored by respawning.
|
* `respawn`: HP restored by respawning.
|
||||||
* The `detail` field may optionally be used to provide a more detailed reason
|
* The `detail` field may optionally be used to provide a more detailed reason
|
||||||
as a string. It's recommended to follow the `modname:detail` naming convention.
|
as a string. It's recommended to follow the `modname:detail` naming convention.
|
||||||
|
|
|
@ -154,7 +154,8 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
||||||
|
|
||||||
// No more breath, damage player
|
// No more breath, damage player
|
||||||
if (m_breath == 0) {
|
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);
|
setHP(m_hp - c.drowning, reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ struct PlayerHPChangeReason
|
||||||
|
|
||||||
// For PLAYER_PUNCH
|
// For PLAYER_PUNCH
|
||||||
ServerActiveObject *object = nullptr;
|
ServerActiveObject *object = nullptr;
|
||||||
// For NODE_DAMAGE
|
// For NODE_DAMAGE and DROWNING
|
||||||
std::string node;
|
std::string node;
|
||||||
v3s16 node_pos;
|
v3s16 node_pos;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue