diff --git a/init.lua b/init.lua index ce1239d..90aac0f 100644 --- a/init.lua +++ b/init.lua @@ -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