updates for blocky survival (xeroxirc)

This commit is contained in:
flux 2019-07-25 01:42:23 +00:00
parent 1c23f8987b
commit 68db07eeb8
6 changed files with 16 additions and 24 deletions

View File

@ -51,8 +51,7 @@ function irc.bot_command(msg, text)
return return
end end
minetest.chat_send_player(player_to, 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!") irc.reply("Message sent!")
return return
end end
@ -138,7 +137,7 @@ irc.register_bot_command("whereis", {
if not player then if not player then
return false, "There is no player named '"..args.."'" return false, "There is no player named '"..args.."'"
end end
local fmt = "Player %s is at (%.2f,%.2f,%.2f)" local fmt = "Player %s is at [CENSORED]"
local pos = player:getpos() local pos = player:getpos()
return true, fmt:format(args, pos.x, pos.y, pos.z) return true, fmt:format(args, pos.x, pos.y, pos.z)
end end

View File

@ -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", "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_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("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

View File

@ -86,7 +86,7 @@ function irc.hooks.ctcp(msg)
if command == "ACTION" and msg.args[1] == irc.config.channel then if command == "ACTION" and msg.args[1] == irc.config.channel then
local action = text:sub(8, -1) 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 elseif command == "VERSION" then
reply(("Minetest version %s, IRC mod version %s.") reply(("Minetest version %s, IRC mod version %s.")
:format(get_core_version(), irc.version)) :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" -- Don't let a user impersonate someone else by using the nick "IRC"
local fake = msg.user.nick:lower():match("^[il|]rc$") local fake = msg.user.nick:lower():match("^[il|]rc$")
if fake then 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 return
end end
@ -138,7 +140,7 @@ function irc.hooks.channelChat(msg)
irc.sendLocal(("* %s@%s %s") irc.sendLocal(("* %s@%s %s")
:format(actionnick, msg.user.nick, actionmessage)) :format(actionnick, msg.user.nick, actionmessage))
else else
irc.sendLocal(("<%s@IRC> %s"):format(msg.user.nick, text)) irc.sendLocal(("<%s@xeroxIRC> %s"):format(msg.user.nick, text))
end end
end end
@ -156,10 +158,10 @@ end
function irc.hooks.kick(channel, target, prefix, reason) function irc.hooks.kick(channel, target, prefix, reason)
if target == irc.conn.nick then 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") irc.disconnect("Kicked")
else 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)) :format(target, channel, prefix.nick, reason))
end end
end end
@ -167,7 +169,7 @@ end
function irc.hooks.notice(user, target, message) function irc.hooks.notice(user, target, message)
if user.nick and target == irc.config.channel then if user.nick and target == irc.config.channel then
irc.sendLocal("-"..user.nick.."@IRC- "..message) irc.sendLocal("-"..user.nick.."@xeroxIRC- "..message)
end end
end end
@ -194,20 +196,20 @@ end
function irc.hooks.join(user, channel) function irc.hooks.join(user, channel)
irc.sendLocal(("-!- %s joined %s") irc.sendLocal(("-!- %s joined %s (xeroxIRC)")
:format(user.nick, channel)) :format(user.nick, channel))
end end
function irc.hooks.part(user, channel, reason) function irc.hooks.part(user, channel, reason)
reason = reason or "" reason = reason or ""
irc.sendLocal(("-!- %s has left %s [%s]") irc.sendLocal(("-!- %s has left %s (xeroxIRC) [%s]")
:format(user.nick, channel, reason)) :format(user.nick, channel, reason))
end end
function irc.hooks.quit(user, reason) function irc.hooks.quit(user, reason)
irc.sendLocal(("-!- %s has quit [%s]") irc.sendLocal(("-!- %s has quit xeroxIRC [%s]")
:format(user.nick, reason)) :format(user.nick, reason))
end end

View File

@ -23,17 +23,12 @@ ie.package.path =
-- /usr/local/share and /usr/local/lib but LuaSocket is often installed under -- /usr/local/share and /usr/local/lib but LuaSocket is often installed under
-- /usr/share and /usr/lib. -- /usr/share and /usr/lib.
if not rawget(_G, "jit") and package.config:sub(1, 1) == "/" then if not rawget(_G, "jit") and package.config:sub(1, 1) == "/" then
ie.package.path = ie.package.path.. ie.package.path = ie.package.path..
";/usr/share/lua/5.1/?.lua".. ";/usr/share/lua/5.1/?.lua"..
";/usr/share/lua/5.1/?/init.lua" ";/usr/share/lua/5.1/?/init.lua"
ie.package.cpath = ie.package.cpath.. ie.package.cpath = ie.package.cpath..
";/usr/lib/lua/5.1/?.so" ";/usr/lib/lua/5.1/?.so"
ie.package.cpath = "/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;"..ie.package.cpath ie.package.cpath = "/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;"..ie.package.cpath
end end
-- Temporarily set require so that LuaIRC can access it -- Temporarily set require so that LuaIRC can access it

View File

@ -8,7 +8,7 @@ function irc.logChat(message)
end end
function irc.sendLocal(message) function irc.sendLocal(message)
minetest.chat_send_all(minetest.colorize(irc.config.chat_color, message)) minetest.chat_send_all(message)
irc.logChat(message) irc.logChat(message)
end end

View File

@ -13,8 +13,6 @@ end
function irc.player_join(name) function irc.player_join(name)
if irc.joined_players[name] then if irc.joined_players[name] then
return false, "You are already in the channel" 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 end
irc.joined_players[name] = true irc.joined_players[name] = true
return true, "You joined the channel" return true, "You joined the channel"
@ -65,8 +63,7 @@ end)
function irc.sendLocal(message) function irc.sendLocal(message)
for name, _ in pairs(irc.joined_players) do for name, _ in pairs(irc.joined_players) do
minetest.chat_send_player(name, minetest.chat_send_player(name, message)
minetest.colorize(irc.config.chat_color, message))
end end
irc.logChat(message) irc.logChat(message)
end end