From 552a79a54ebd4d5bf886840858c92b6b9bf9e1d1 Mon Sep 17 00:00:00 2001 From: MinetestSam <42088654+MinetestSam@users.noreply.github.com> Date: Wed, 2 Oct 2019 20:02:09 +0530 Subject: [PATCH] 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. --- mods/other/vote/init.lua | 3 ++- mods/other/vote/vote_kick.lua | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/other/vote/init.lua b/mods/other/vote/init.lua index c8edab0..320fe04 100644 --- a/mods/other/vote/init.lua +++ b/mods/other/vote/init.lua @@ -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") diff --git a/mods/other/vote/vote_kick.lua b/mods/other/vote/vote_kick.lua index cf29a9e..009a51d 100644 --- a/mods/other/vote/vote_kick.lua +++ b/mods/other/vote/vote_kick.lua @@ -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, " ..