Add vote and vote_starter priv
This commit is contained in:
parent
f1e45f006c
commit
9a8935c389
2 changed files with 22 additions and 7 deletions
|
@ -42,13 +42,15 @@ end
|
||||||
|
|
||||||
minetest.register_chatcommand("vote", {
|
minetest.register_chatcommand("vote", {
|
||||||
privs = {
|
privs = {
|
||||||
interact = true
|
interact = true,
|
||||||
|
vote_starter = true
|
||||||
},
|
},
|
||||||
func = ctf_match.vote_next
|
func = ctf_match.vote_next
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_chat_message(function(name, msg)
|
minetest.register_on_chat_message(function(name, msg)
|
||||||
if msg == "/vote_next" then
|
if msg == "/vote_next" and minetest.check_player_privs(name,
|
||||||
|
{interact=true, vote_starter=true}) then
|
||||||
local suc, msg = ctf_match.vote_next(name)
|
local suc, msg = ctf_match.vote_next(name)
|
||||||
if msg then
|
if msg then
|
||||||
minetest.chat_send_player(name, msg)
|
minetest.chat_send_player(name, msg)
|
||||||
|
|
|
@ -162,7 +162,8 @@ vote.hud = hudkit()
|
||||||
function vote.update_hud(player)
|
function vote.update_hud(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local voteset = vote.get_next_vote(name)
|
local voteset = vote.get_next_vote(name)
|
||||||
if not voteset then
|
if not voteset or not minetest.check_player_privs(name,
|
||||||
|
{interact=true, vote=true}) then
|
||||||
vote.hud:remove(player, "vote:desc")
|
vote.hud:remove(player, "vote:desc")
|
||||||
vote.hud:remove(player, "vote:bg")
|
vote.hud:remove(player, "vote:bg")
|
||||||
vote.hud:remove(player, "vote:help")
|
vote.hud:remove(player, "vote:help")
|
||||||
|
@ -222,9 +223,18 @@ function vote.update_all_hud()
|
||||||
end
|
end
|
||||||
minetest.after(5, vote.update_all_hud)
|
minetest.after(5, vote.update_all_hud)
|
||||||
|
|
||||||
|
minetest.register_privilege("vote", {
|
||||||
|
description = "Can vote on issues"
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_privilege("vote_starter", {
|
||||||
|
description = "Can vote on issues"
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_chatcommand("yes", {
|
minetest.register_chatcommand("yes", {
|
||||||
privs = {
|
privs = {
|
||||||
interact = true
|
interact = true,
|
||||||
|
vote = true
|
||||||
},
|
},
|
||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
local voteset = vote.get_next_vote(name)
|
local voteset = vote.get_next_vote(name)
|
||||||
|
@ -247,7 +257,8 @@ minetest.register_chatcommand("yes", {
|
||||||
|
|
||||||
minetest.register_chatcommand("no", {
|
minetest.register_chatcommand("no", {
|
||||||
privs = {
|
privs = {
|
||||||
interact = true
|
interact = true,
|
||||||
|
vote = true
|
||||||
},
|
},
|
||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
local voteset = vote.get_next_vote(name)
|
local voteset = vote.get_next_vote(name)
|
||||||
|
@ -270,7 +281,8 @@ minetest.register_chatcommand("no", {
|
||||||
|
|
||||||
minetest.register_chatcommand("abstain", {
|
minetest.register_chatcommand("abstain", {
|
||||||
privs = {
|
privs = {
|
||||||
interact = true
|
interact = true,
|
||||||
|
vote = true
|
||||||
},
|
},
|
||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
local voteset = vote.get_next_vote(name)
|
local voteset = vote.get_next_vote(name)
|
||||||
|
@ -297,7 +309,8 @@ local set = minetest.setting_get("vote.kick_vote")
|
||||||
if set == nil or minetest.is_yes(set) then
|
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,
|
||||||
|
vote_starter = true
|
||||||
},
|
},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if not minetest.get_player_by_name(param) then
|
if not minetest.get_player_by_name(param) then
|
||||||
|
|
Loading…
Reference in a new issue