Disable kick voting by default

This commit is contained in:
rubenwardy 2015-09-01 18:22:34 +01:00
parent 100aa81a4f
commit c132ffda60
2 changed files with 44 additions and 49 deletions

View file

@ -2,6 +2,7 @@ give_initial_stuff = true
enable_pvp = true enable_pvp = true
fixed_map_seed = 14703851313754985906 fixed_map_seed = 14703851313754985906
map_generation_limit = 160 map_generation_limit = 160
vote.kick_vote = false
# See mods/ctf_pvp_engine/minetest.conf.example for ctf_pvp_engine settings. # See mods/ctf_pvp_engine/minetest.conf.example for ctf_pvp_engine settings.
ctf.flag.capture_take = true ctf.flag.capture_take = true

View file

@ -72,22 +72,13 @@ function vote.end_vote(voteset)
elseif voteset.results.yes and voteset.results.no then elseif voteset.results.yes and voteset.results.no then
local total = #voteset.results.yes + #voteset.results.no local total = #voteset.results.yes + #voteset.results.no
local perc_needed = voteset.perc_needed or 0.5 local perc_needed = voteset.perc_needed or 0.5
local unanimous = voteset.unanimous or 0
if total <= unanimous then
if #voteset.results.no == 0 then
result = "yes"
else
result = "no"
end
else
if #voteset.results.yes / total > perc_needed then if #voteset.results.yes / total > perc_needed then
result = "yes" result = "yes"
else else
result = "no" result = "no"
end end
end end
end
minetest.log("action", "Vote '" .. voteset.description .. minetest.log("action", "Vote '" .. voteset.description ..
"' ended with result '" .. result .. "'.") "' ended with result '" .. result .. "'.")
@ -284,6 +275,8 @@ minetest.register_chatcommand("abstain", {
end end
}) })
local set = minetest.setting_get("vote.kick_vote")
if set == nil or minetest.is_yes(set) then
minetest.register_chatcommand("vote_kick", { minetest.register_chatcommand("vote_kick", {
privs = { privs = {
interact = true interact = true
@ -322,3 +315,4 @@ minetest.register_chatcommand("vote_kick", {
}) })
end end
}) })
end