1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-12-22 22:55:28 +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:
Wuzzy
2025-12-20 15:12:34 +01:00
committed by GitHub
parent 9c37b46e1f
commit f567449cd6
5 changed files with 43 additions and 20 deletions

View File

@@ -435,7 +435,7 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
core.add_item(pos, replace_with_item)
end
user:set_hp(user:get_hp() + hp_change)
user:set_hp(user:get_hp() + hp_change, {type="set_hp", custom_type="__builtin:item_eat"})
return nil -- don't overwrite wield item a second time
end