Broaden death message
parent
fd593f1998
commit
d619784b1c
19
init.lua
19
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
|
||||
|
|
Loading…
Reference in New Issue