Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Commit

Permalink
Color teamname not username in team chat
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jan 2, 2018
1 parent c56d3c8 commit 8ffdefa
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions ctf_chat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,21 @@ minetest.register_chatcommand("t", {
end
})

if minetest.global_exists("irc") then
function irc.playerMessage(name, message)
local tname = ctf.player(name).team
local color = ctf_colors.get_irc_color(name, ctf.player(name))
local clear = "\x0F"
if color then
color = "\x03" .. color
else
color = ""
clear = ""
end
return ("%s%s%s <%s> %s"):format(color, tname, clear, name, message)
end
end

-- Chat plus stuff
if minetest.global_exists("chatplus") then
function chatplus.log_message(from, msg)
Expand All @@ -370,22 +385,6 @@ if minetest.global_exists("chatplus") then
minetest.chat_send_player(from, minetest.colorize("#" .. colorHex:sub(3, 8), "<" .. from .. "> ") .. msg)
end

if minetest.global_exists("irc") then
function irc.playerMessage(name, message)
local color = ctf_colors.get_irc_color(name, ctf.player(name))
local clear = "\x0F"
print("color is " .. color)
if color then
color = "\x03" .. color
else
color = ""
clear = ""
end
print("message: " .. ("%s<%s>%s %s"):format(color, name, clear, message))
return ("%s<%s>%s %s"):format(color, name, clear, message)
end
end

chatplus.register_handler(function(from, to, msg)
if not ctf.setting("chat.team_channel") then
-- Send to global
Expand Down

0 comments on commit 8ffdefa

Please sign in to comment.