updates for blocky survival (xeroxirc)
This commit is contained in:
parent
1c23f8987b
commit
68db07eeb8
@ -51,8 +51,7 @@ function irc.bot_command(msg, text)
|
||||
return
|
||||
end
|
||||
minetest.chat_send_player(player_to,
|
||||
minetest.colorize(irc.config.pm_color,
|
||||
"PM from "..msg.user.nick.."@IRC: "..message, false))
|
||||
"PM from "..msg.user.nick.."@IRC: "..message, false)
|
||||
irc.reply("Message sent!")
|
||||
return
|
||||
end
|
||||
@ -138,7 +137,7 @@ irc.register_bot_command("whereis", {
|
||||
if not player then
|
||||
return false, "There is no player named '"..args.."'"
|
||||
end
|
||||
local fmt = "Player %s is at (%.2f,%.2f,%.2f)"
|
||||
local fmt = "Player %s is at [CENSORED]"
|
||||
local pos = player:getpos()
|
||||
return true, fmt:format(args, pos.x, pos.y, pos.z)
|
||||
end
|
||||
|
@ -65,5 +65,4 @@ setting("bool", "debug", false) -- Enable debug output
|
||||
setting("bool", "enable_player_part", true) -- Whether to enable players joining and parting the channel
|
||||
setting("bool", "auto_join", true) -- Whether to automatically show players in the channel when they join
|
||||
setting("bool", "auto_connect", true) -- Whether to automatically connect to the server on mod load
|
||||
setting("string", "chat_color", "#339933") -- Color of IRC chat in-game, green by default
|
||||
setting("string", "pm_color", "#8800AA") -- Color of IRC PMs in-game, purple by default
|
||||
|
||||
|
20
hooks.lua
20
hooks.lua
@ -86,7 +86,7 @@ function irc.hooks.ctcp(msg)
|
||||
|
||||
if command == "ACTION" and msg.args[1] == irc.config.channel then
|
||||
local action = text:sub(8, -1)
|
||||
irc.sendLocal(("* %s@IRC %s"):format(msg.user.nick, action))
|
||||
irc.sendLocal(("* %s@xeroxIRC %s"):format(msg.user.nick, action))
|
||||
elseif command == "VERSION" then
|
||||
reply(("Minetest version %s, IRC mod version %s.")
|
||||
:format(get_core_version(), irc.version))
|
||||
@ -106,7 +106,9 @@ function irc.hooks.channelChat(msg)
|
||||
-- Don't let a user impersonate someone else by using the nick "IRC"
|
||||
local fake = msg.user.nick:lower():match("^[il|]rc$")
|
||||
if fake then
|
||||
irc.sendLocal("<"..msg.user.nick.."@IRC> "..text)
|
||||
irc.sendLocal("<"..msg.user.nick.."@xeroxIRC> "..text)
|
||||
return
|
||||
elseif msg.user.nick == "BlockyRelay" then
|
||||
return
|
||||
end
|
||||
|
||||
@ -138,7 +140,7 @@ function irc.hooks.channelChat(msg)
|
||||
irc.sendLocal(("* %s@%s %s")
|
||||
:format(actionnick, msg.user.nick, actionmessage))
|
||||
else
|
||||
irc.sendLocal(("<%s@IRC> %s"):format(msg.user.nick, text))
|
||||
irc.sendLocal(("<%s@xeroxIRC> %s"):format(msg.user.nick, text))
|
||||
end
|
||||
end
|
||||
|
||||
@ -156,10 +158,10 @@ end
|
||||
|
||||
function irc.hooks.kick(channel, target, prefix, reason)
|
||||
if target == irc.conn.nick then
|
||||
minetest.chat_send_all("IRC: kicked from "..channel.." by "..prefix.nick..".")
|
||||
minetest.chat_send_all("IRC: kicked from "..channel.." (xeroxIRC) by "..prefix.nick..".")
|
||||
irc.disconnect("Kicked")
|
||||
else
|
||||
irc.sendLocal(("-!- %s was kicked from %s by %s [%s]")
|
||||
irc.sendLocal(("-!- %s was kicked from %s (xeroxIRC) by %s [%s]")
|
||||
:format(target, channel, prefix.nick, reason))
|
||||
end
|
||||
end
|
||||
@ -167,7 +169,7 @@ end
|
||||
|
||||
function irc.hooks.notice(user, target, message)
|
||||
if user.nick and target == irc.config.channel then
|
||||
irc.sendLocal("-"..user.nick.."@IRC- "..message)
|
||||
irc.sendLocal("-"..user.nick.."@xeroxIRC- "..message)
|
||||
end
|
||||
end
|
||||
|
||||
@ -194,20 +196,20 @@ end
|
||||
|
||||
|
||||
function irc.hooks.join(user, channel)
|
||||
irc.sendLocal(("-!- %s joined %s")
|
||||
irc.sendLocal(("-!- %s joined %s (xeroxIRC)")
|
||||
:format(user.nick, channel))
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.part(user, channel, reason)
|
||||
reason = reason or ""
|
||||
irc.sendLocal(("-!- %s has left %s [%s]")
|
||||
irc.sendLocal(("-!- %s has left %s (xeroxIRC) [%s]")
|
||||
:format(user.nick, channel, reason))
|
||||
end
|
||||
|
||||
|
||||
function irc.hooks.quit(user, reason)
|
||||
irc.sendLocal(("-!- %s has quit [%s]")
|
||||
irc.sendLocal(("-!- %s has quit xeroxIRC [%s]")
|
||||
:format(user.nick, reason))
|
||||
end
|
||||
|
||||
|
5
init.lua
5
init.lua
@ -23,17 +23,12 @@ ie.package.path =
|
||||
-- /usr/local/share and /usr/local/lib but LuaSocket is often installed under
|
||||
-- /usr/share and /usr/lib.
|
||||
if not rawget(_G, "jit") and package.config:sub(1, 1) == "/" then
|
||||
|
||||
ie.package.path = ie.package.path..
|
||||
";/usr/share/lua/5.1/?.lua"..
|
||||
";/usr/share/lua/5.1/?/init.lua"
|
||||
|
||||
ie.package.cpath = ie.package.cpath..
|
||||
";/usr/lib/lua/5.1/?.so"
|
||||
|
||||
ie.package.cpath = "/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;"..ie.package.cpath
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- Temporarily set require so that LuaIRC can access it
|
||||
|
@ -8,7 +8,7 @@ function irc.logChat(message)
|
||||
end
|
||||
|
||||
function irc.sendLocal(message)
|
||||
minetest.chat_send_all(minetest.colorize(irc.config.chat_color, message))
|
||||
minetest.chat_send_all(message)
|
||||
irc.logChat(message)
|
||||
end
|
||||
|
||||
|
@ -13,8 +13,6 @@ end
|
||||
function irc.player_join(name)
|
||||
if irc.joined_players[name] then
|
||||
return false, "You are already in the channel"
|
||||
elseif not minetest.get_player_by_name(name) then
|
||||
return false, "You need to be in-game to join the channel"
|
||||
end
|
||||
irc.joined_players[name] = true
|
||||
return true, "You joined the channel"
|
||||
@ -65,8 +63,7 @@ end)
|
||||
|
||||
function irc.sendLocal(message)
|
||||
for name, _ in pairs(irc.joined_players) do
|
||||
minetest.chat_send_player(name,
|
||||
minetest.colorize(irc.config.chat_color, message))
|
||||
minetest.chat_send_player(name, message)
|
||||
end
|
||||
irc.logChat(message)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user