Broaden death message

main
Bram van den Heuvel 2024-02-21 00:28:45 +01:00
parent fd593f1998
commit d619784b1c
1 changed files with 19 additions and 0 deletions

View File

@ -42,6 +42,25 @@ 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
matrix.send(http_api, name .. " fell from a high place")
elseif reason.type == "drown" then
matrix.send(http_api, name .. " drowned")
elseif reason.type == "punch" then
local creature = "an enemy"
local puncher = reason.object
if puncher:is_player() then
creature = puncher:get_player_name()
else
creature = puncher:get_entity_name()
end
matrix.send(http_api, name .. " was slain by " .. creature)
else
matrix.send(http_api, name .. " died. Reason:", reason.type)
end
end)
-- Start Matrix sync