Add eligibility criteria for participating in kick votes (#463)

Players should have a score of 1000 or greater to be able to vote in kick votes.
This commit is contained in:
MinetestSam 2019-10-02 20:02:09 +05:30 committed by ANAND
parent 2ae401d4f5
commit 552a79a54e
2 changed files with 6 additions and 1 deletions

View file

@ -165,7 +165,8 @@ function vote.update_hud(player)
local name = player:get_player_name()
local voteset = vote.get_next_vote(name)
if not voteset or not minetest.check_player_privs(name,
{interact=true, vote=true}) then
{interact = true, vote = true}) or
(voteset.can_vote and not voteset:can_vote(name)) then
vote.hud:remove(player, "vote:desc")
vote.hud:remove(player, "vote:bg")
vote.hud:remove(player, "vote:help")

View file

@ -59,6 +59,10 @@ minetest.register_chatcommand("vote_kick", {
duration = 60,
perc_needed = 0.8,
can_vote = function(self, pname)
return ctf_stats.player(pname).score > 1000
end,
on_result = function(self, result, results)
if result == "yes" then
minetest.chat_send_all("Vote passed, " ..