Log death messages into a text file

- Solves part of #58
This commit is contained in:
LeMagnesium 2015-09-05 15:09:30 +02:00
parent 1ae26b05f9
commit 8990897e53
1 changed files with 5 additions and 1 deletions

View File

@ -7,12 +7,13 @@ dofile(minetest.get_modpath("death_messages").."/settings.txt")
-----------------------------------------------------------------------------------------------
-- A table of quips for death messages
local messages = {}
-- Another one to avoid double death messages
local whacked = {}
local logfile = minetest.get_worldpath() .. "/death_logs.txt"
-- Fill this table with sounds
local sounds = {
[1] = "death_messages_player_1",
@ -90,6 +91,9 @@ messages.whacking = {
local function broadcast_death(msg)
minetest.chat_send_all(msg)
local logfilep = io.open(logfile, "a")
logfilep:write(os.date("[%Y-%m-%d %H:%M:%S] ") .. msg .. "\n")
logfilep:close()
if irc then
irc:say(msg)
end