Compare commits
No commits in common. "devel" and "master" have entirely different histories.
54
init.lua
54
init.lua
@ -3,8 +3,6 @@ vote = {
|
||||
queue = {}
|
||||
}
|
||||
|
||||
local storage = core.get_mod_storage()
|
||||
|
||||
function vote.new_vote(creator, voteset)
|
||||
local max_votes = tonumber(minetest.setting_get("vote.maximum_active")) or 1
|
||||
|
||||
@ -112,19 +110,8 @@ end
|
||||
function vote.check_vote(voteset)
|
||||
local all_players_voted = true
|
||||
local players = minetest.get_connected_players()
|
||||
local ignored_players = storage:get_string("ignored_players"):split(" ")
|
||||
for _, player in pairs(players) do
|
||||
local name = player:get_player_name()
|
||||
local is_ignored = false
|
||||
for _, ignored_name in ipairs(ignored_players) do
|
||||
if name == ignored_name then
|
||||
is_ignored = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if is_ignored then
|
||||
break
|
||||
end
|
||||
if not voteset.results.voted[name] then
|
||||
all_players_voted = false
|
||||
break
|
||||
@ -302,44 +289,3 @@ minetest.register_chatcommand("abstain", {
|
||||
vote.check_vote(voteset)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("vote_list_ignored", {
|
||||
privs = {
|
||||
vote_admin = true,
|
||||
},
|
||||
description = "Get a list of players ignored during voting",
|
||||
func = function(name, params)
|
||||
minetest.chat_send_player(
|
||||
name,
|
||||
"Ignored players: " .. storage:get_string("ignored_players")
|
||||
)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("vote_ignore", {
|
||||
privs = {
|
||||
vote_admin = true,
|
||||
},
|
||||
description = "Ignore player(s) during voting",
|
||||
params = "<PlayerName>...",
|
||||
func = function(name, params)
|
||||
storage:set_string(
|
||||
"ignored_players",
|
||||
storage:get_string("ignored_players") .. params.. " "
|
||||
)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("vote_clear_ignored", {
|
||||
privs = {
|
||||
vote_admin = true,
|
||||
},
|
||||
description = "Clear list of players ignored during voting",
|
||||
func = function(name, params)
|
||||
storage:set_string("ignored_players","")
|
||||
minetest.chat_send_player(
|
||||
name,
|
||||
"The list of ignored players has been cleared"
|
||||
)
|
||||
end
|
||||
})
|
Loading…
Reference in New Issue
Block a user