2013-04-29 15:07:44 -07:00
|
|
|
-- This file is licensed under the terms of the BSD 2-clause license.
|
|
|
|
-- See LICENSE.txt for details.
|
2013-01-08 07:50:47 -08:00
|
|
|
|
|
|
|
|
2013-04-29 15:07:44 -07:00
|
|
|
minetest.register_on_joinplayer(function(player)
|
|
|
|
local name = player:get_player_name()
|
2014-05-25 19:52:24 -07:00
|
|
|
if irc.connected and irc.config.send_join_part then
|
|
|
|
irc:say("*** "..name.." joined the game")
|
2013-04-25 14:00:44 -07:00
|
|
|
end
|
2013-04-29 15:07:44 -07:00
|
|
|
end)
|
2013-01-08 16:50:56 -08:00
|
|
|
|
2013-01-08 16:22:45 -08:00
|
|
|
|
2016-06-19 19:20:20 -07:00
|
|
|
minetest.register_on_leaveplayer(function(player, timed_out)
|
2013-04-29 15:07:44 -07:00
|
|
|
local name = player:get_player_name()
|
2014-05-25 19:52:24 -07:00
|
|
|
if irc.connected and irc.config.send_join_part then
|
2016-06-19 19:20:20 -07:00
|
|
|
irc:say("*** "..name.." left the game"..
|
|
|
|
(timed_out and " (Timed out)" or ""))
|
2013-04-25 14:00:44 -07:00
|
|
|
end
|
2013-04-29 15:07:44 -07:00
|
|
|
end)
|
2013-01-01 15:15:45 -08:00
|
|
|
|
2013-01-08 07:50:47 -08:00
|
|
|
|
2013-04-29 15:07:44 -07:00
|
|
|
minetest.register_on_chat_message(function(name, message)
|
2014-05-25 19:52:24 -07:00
|
|
|
if not irc.connected
|
2013-04-29 15:07:44 -07:00
|
|
|
or message:sub(1, 1) == "/"
|
2013-12-27 06:57:35 -08:00
|
|
|
or message:sub(1, 5) == "[off]"
|
2014-05-25 19:52:24 -07:00
|
|
|
or not irc.joined_players[name]
|
2013-04-29 15:07:44 -07:00
|
|
|
or (not minetest.check_player_privs(name, {shout=true})) then
|
|
|
|
return
|
2013-04-25 14:00:44 -07:00
|
|
|
end
|
2014-01-08 17:39:21 -08:00
|
|
|
local nl = message:find("\n", 1, true)
|
|
|
|
if nl then
|
|
|
|
message = message:sub(1, nl - 1)
|
|
|
|
end
|
2014-05-25 19:52:24 -07:00
|
|
|
irc:say(irc:playerMessage(name, message))
|
2013-04-29 15:07:44 -07:00
|
|
|
end)
|
2013-01-18 22:59:38 -08:00
|
|
|
|
2013-03-28 19:29:23 -07:00
|
|
|
|
2013-04-29 15:07:44 -07:00
|
|
|
minetest.register_on_shutdown(function()
|
2014-05-25 19:52:24 -07:00
|
|
|
irc:disconnect("Game shutting down.")
|
2013-03-28 19:29:23 -07:00
|
|
|
end)
|
|
|
|
|