1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Dehardcode the death formspec (#15155)

Co-authored-by: Paul Ouellette <oue.paul18@gmail.com>
This commit is contained in:
grorp 2024-09-24 22:37:44 +02:00 committed by GitHub
parent 3c48671076
commit 526a2f7b8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
79 changed files with 242 additions and 172 deletions

View file

@ -338,8 +338,6 @@ Call these functions only at load time!
is checked to see if the command exists, but after the input is parsed.
* Return `true` to mark the command as handled, which means that the default
handlers will be prevented.
* `minetest.register_on_death(function())`
* Called when the local player dies
* `minetest.register_on_hp_modification(function(hp))`
* Called when server modified player's HP
* `minetest.register_on_damage_taken(function(hp))`
@ -487,8 +485,6 @@ Call these functions only at load time!
* Returns `false` if the client is already disconnecting otherwise returns `true`.
* `minetest.get_server_info()`
* Returns [server info](#server-info).
* `minetest.send_respawn()`
* Sends a respawn request to the server.
### Storage API
* `minetest.get_mod_storage()`:

View file

@ -5869,6 +5869,7 @@ Call these functions only at load time!
* `minetest.register_on_dieplayer(function(ObjectRef, reason))`
* Called when a player dies
* `reason`: a PlayerHPChangeReason table, see register_on_player_hpchange
* For customizing the death screen, see `minetest.show_death_screen`.
* `minetest.register_on_respawnplayer(function(ObjectRef))`
* Called when player is to be respawned
* Called _before_ repositioning of player occurs
@ -6573,6 +6574,13 @@ Formspec
* `"INV"`: something failed
* `"CHG"`: has been changed
* `"VAL"`: not changed
* `minetest.show_death_screen(player, reason)`
* Called when the death screen should be shown.
* `player` is an ObjectRef, `reason` is a PlayerHPChangeReason table or nil.
* By default, this shows a simple formspec with the option to respawn.
Respawning is done via `ObjectRef:respawn`.
* You can override this to show a custom death screen.
* For general death handling, use `minetest.register_on_dieplayer` instead.
Item handling
-------------