Send kills to IRC channel
This commit is contained in:
parent
ead8366790
commit
460fd335ff
2 changed files with 32 additions and 0 deletions
|
@ -1,2 +1,3 @@
|
||||||
ctf
|
ctf
|
||||||
hudkit
|
hudkit
|
||||||
|
irc?
|
||||||
|
|
|
@ -10,6 +10,27 @@ ctf_events = {
|
||||||
events = {}
|
events = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local emoji = {
|
||||||
|
kill_bullet = ",-",
|
||||||
|
kill_grenade = "o'",
|
||||||
|
kill_sword = "+--",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function get_colorcodes(name)
|
||||||
|
if not name then
|
||||||
|
return "", ""
|
||||||
|
end
|
||||||
|
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 color, clear
|
||||||
|
end
|
||||||
|
|
||||||
function ctf_events.post(action, one, two)
|
function ctf_events.post(action, one, two)
|
||||||
table.insert(ctf_events.events, 1, {
|
table.insert(ctf_events.events, 1, {
|
||||||
action = action,
|
action = action,
|
||||||
|
@ -17,6 +38,16 @@ function ctf_events.post(action, one, two)
|
||||||
two = two
|
two = two
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if minetest.global_exists("irc") and emoji[action] then
|
||||||
|
local color1, clear1 = get_colorcodes(one)
|
||||||
|
local color2, clear2 = get_colorcodes(two)
|
||||||
|
local tag1 = one and (color1 .. "_" .. clear1) or ""
|
||||||
|
local tag2 = two and (color2 .. "_" .. clear2) or ""
|
||||||
|
local name1 = one and (tag1 .. one .. tag1) or ""
|
||||||
|
local name2 = two and (tag2 .. two .. tag2) or ""
|
||||||
|
irc.say((name1 .. " " .. emoji[action] .. " " .. name2):trim())
|
||||||
|
end
|
||||||
|
|
||||||
while #ctf_events.events > NUM_EVT do
|
while #ctf_events.events > NUM_EVT do
|
||||||
table.remove(ctf_events.events, #ctf_events.events)
|
table.remove(ctf_events.events, #ctf_events.events)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue