Add irc support to ctf_match: report on new match/vote started/win

This commit is contained in:
rubenwardy 2016-04-04 22:26:47 +01:00
parent 368ab665ab
commit 9fad339b6b
3 changed files with 18 additions and 0 deletions

View file

@ -3,3 +3,4 @@ ctf_flag
ctf_inventory ctf_inventory
vote vote
hudkit hudkit
irc?

View file

@ -20,3 +20,15 @@ minetest.register_on_leaveplayer(function(player)
ctf.remove_player(player:get_player_name()) ctf.remove_player(player:get_player_name())
end end
end) end)
if minetest.global_exists("irc") then
ctf_match.register_on_winner(function(winner)
if not irc.connected then return end
irc:say("Team " .. winner .. " won!")
end)
ctf.register_on_new_game(function()
if not irc.connected then return end
irc:say("Next round!")
end)
end

View file

@ -7,6 +7,11 @@ function ctf_match.register_on_skip_map(func)
end end
function ctf_match.vote_next(name, params) function ctf_match.vote_next(name, params)
if minetest.global_exists("irc") then
local tname = ctf.player(name).team or "none"
irc:say("Vote started by " .. name .. " (team " .. tname .. ")")
end
return vote.new_vote(name, { return vote.new_vote(name, {
description = "Skip to next match", description = "Skip to next match",
help = "/yes, /no or /abstain", help = "/yes, /no or /abstain",