Remove chatplus leftovers (#36)
This commit is contained in:
parent
719ab291ce
commit
26f496aced
@ -375,88 +375,31 @@ if minetest.global_exists("irc") then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Chat plus stuff
|
local function handler(name, message)
|
||||||
if minetest.global_exists("chatplus") then
|
if ctf.player(name).team then
|
||||||
function chatplus.log_message(from, msg)
|
for i = 2, #minetest.registered_on_chat_messages do
|
||||||
local tname = ctf.player(from).team or ""
|
|
||||||
chatplus.log(tname .. "<" .. from .. "> " .. msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
function chatplus.send_message_to_sender(from, msg)
|
|
||||||
local tcolor = ctf_colors.get_color(ctf.player(from))
|
|
||||||
minetest.chat_send_player(from, minetest.colorize(tcolor.css, "<" .. from .. "> ") .. msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
chatplus.register_handler(function(from, to, msg)
|
|
||||||
if not ctf.setting("chat.team_channel") then
|
|
||||||
-- Send to global
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if ctf.setting("chat.default") ~= "team" then
|
|
||||||
local team_name = ctf.player(from).team
|
|
||||||
if team_name then
|
|
||||||
local tcolor = ctf_colors.get_color(ctf.player(from))
|
|
||||||
minetest.chat_send_player(to,
|
|
||||||
minetest.colorize(tcolor.css, "<" .. from .. "> ") .. msg)
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Send to team
|
|
||||||
local fromp = ctf.player(from)
|
|
||||||
local top = ctf.player(to)
|
|
||||||
|
|
||||||
if not fromp.team then
|
|
||||||
if not ctf.setting("chat.global_channel") then
|
|
||||||
-- Send to global
|
|
||||||
return nil
|
|
||||||
else
|
|
||||||
-- Global channel is disabled
|
|
||||||
minetest.chat_send_player(from,
|
|
||||||
"You are not yet part of a team! Join one so you can chat to people.",
|
|
||||||
false)
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if top.team == fromp.team then
|
|
||||||
minetest.chat_send_player(to, "<" .. from .. "> ** " .. msg .. " **")
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end)
|
|
||||||
|
|
||||||
else
|
|
||||||
local function handler(name, message)
|
|
||||||
local team_name = ctf.player(name).team
|
|
||||||
if team_name then
|
|
||||||
for i=1, #minetest.registered_on_chat_messages do
|
|
||||||
local func = minetest.registered_on_chat_messages[i]
|
local func = minetest.registered_on_chat_messages[i]
|
||||||
if func ~= handler then
|
|
||||||
if func(name, message) then
|
if func(name, message) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if not minetest.check_player_privs(name, {shout = true}) then
|
if not minetest.check_player_privs(name, {shout = true}) then
|
||||||
minetest.chat_send_player("-!- You don't have permission to shout.")
|
minetest.chat_send_player("-!- You don't have permission to shout.")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
local tcolor = ctf_colors.get_color(ctf.player(name))
|
local tcolor = ctf_colors.get_color(ctf.player(name))
|
||||||
minetest.chat_send_all(minetest.colorize(tcolor.css, "<" .. name .. "> ") .. message)
|
minetest.chat_send_all(minetest.colorize(tcolor.css,
|
||||||
|
"<" .. name .. "> ") .. message)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.insert(minetest.registered_on_chat_messages, 1, handler)
|
table.insert(minetest.registered_on_chat_messages, 1, handler)
|
||||||
|
|
||||||
minetest.registered_chatcommands["me"].func = function(name, param)
|
minetest.registered_chatcommands["me"].func = function(name, param)
|
||||||
local team_name = ctf.player(name).team
|
if ctf.player(name).team then
|
||||||
if team_name then
|
|
||||||
local tcolor = ctf_colors.get_color(ctf.player(name))
|
local tcolor = ctf_colors.get_color(ctf.player(name))
|
||||||
name = minetest.colorize(tcolor.css, "* " .. name)
|
name = minetest.colorize(tcolor.css, "* " .. name)
|
||||||
else
|
else
|
||||||
@ -464,5 +407,4 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.chat_send_all(name .. " " .. param)
|
minetest.chat_send_all(name .. " " .. param)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user