Remove nil value on death message

main
Bram van den Heuvel 2024-02-21 00:32:46 +01:00
parent d619784b1c
commit 6ee151759b
1 changed files with 3 additions and 2 deletions

View File

@ -41,9 +41,10 @@ minetest.register_on_leaveplayer(function(ObjectRef, timed_out)
end)
minetest.register_on_dieplayer(function(ObjectRef, reason)
local name = ObjectRef:get_player_name()
matrix.send(http_api, name .. " has died! Reason:", reason)
if reason.type == "fall" then
if reason.type == nil then
matrix.send(http_api, name .. " died. Reason:", "unknown")
elseif reason.type == "fall" then
matrix.send(http_api, name .. " fell from a high place")
elseif reason.type == "drown" then
matrix.send(http_api, name .. " drowned")