mirror of
https://gitlab.com/lunovox/e-urn.git
synced 2025-03-20 17:51:21 +00:00
This commit is contained in:
parent
7ba6a503c9
commit
68454c2124
3 changed files with 182 additions and 140 deletions
|
@ -34,7 +34,8 @@ Colect opinion of player with electronic urn.
|
||||||
| ````/candidate```` or ````/campaign```` | ````[<candidate_name>]```` | Show the Campaign of candidate for president. |
|
| ````/candidate```` or ````/campaign```` | ````[<candidate_name>]```` | Show the Campaign of candidate for president. |
|
||||||
| ````/vote```` | ````[<candidate_name>]```` | Vote for a specific candidate for president. Need a minimum number of hours of online play. |
|
| ````/vote```` | ````[<candidate_name>]```` | Vote for a specific candidate for president. Need a minimum number of hours of online play. |
|
||||||
| ````/unvote```` | | Unvote for presidetial candidate. |
|
| ````/unvote```` | | Unvote for presidetial candidate. |
|
||||||
| ````/votes```` | | Show the name of all candidates for president with the amount of votes. Need privilege ````electoraljudge````.
|
| ````/votes```` | | Show the name of all candidates for president with the amount of votes. Need the ````electoraljudge```` privilege. |
|
||||||
|
| ````/election```` | | Apply presidential selection vote counting! Need the ````electoraljudge```` privilege. |
|
||||||
|
|
||||||
## **API:**
|
## **API:**
|
||||||
|
|
||||||
|
|
154
api.lua
154
api.lua
|
@ -53,10 +53,10 @@ modEUrn.unsortTableByValue = function(tbl)
|
||||||
return tbl
|
return tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
modEUrn.sortTableLenght = function(t)
|
modEUrn.sortTableLenght = function(tbl)
|
||||||
local count = 0
|
local count = 0
|
||||||
--modEUrn.debug("t = "..dump(t))
|
--modEUrn.debug("t = "..dump(t))
|
||||||
for _ in pairs(t) do
|
for _ in pairs(tbl) do
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
return count
|
return count
|
||||||
|
@ -142,28 +142,24 @@ modEUrn.getPresidentName = function()
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
modEUrn.doPresident = function(playername, candidatename)
|
modEUrn.doCheckDataBase = function(candidatename)
|
||||||
if minetest.player_exists(candidatename) then
|
--modEUrn.handler.elected
|
||||||
local now = os.time() --Em milisegundos
|
if modEUrn.handler.elected==nil then
|
||||||
|
modEUrn.handler.elected = { }
|
||||||
--modEUrn.handler.elected
|
end
|
||||||
if modEUrn.handler.elected==nil then
|
if modEUrn.handler.elected.president==nil then
|
||||||
modEUrn.handler.elected = { }
|
modEUrn.handler.elected.president = { }
|
||||||
end
|
end
|
||||||
if modEUrn.handler.elected.president==nil then
|
|
||||||
modEUrn.handler.elected.president = { }
|
--modEUrn.handler.candidates
|
||||||
end
|
if modEUrn.handler.candidates==nil then
|
||||||
modEUrn.handler.elected.president.name = candidatename
|
modEUrn.handler.candidates = { }
|
||||||
modEUrn.handler.elected.president.when = now
|
end
|
||||||
|
if modEUrn.handler.candidates.president==nil then
|
||||||
|
modEUrn.handler.candidates.president = { }
|
||||||
--modEUrn.handler.candidates
|
end
|
||||||
if modEUrn.handler.candidates==nil then
|
|
||||||
modEUrn.handler.candidates = { }
|
if type(candidatename)=="string" and candidatename~="" then
|
||||||
end
|
|
||||||
if modEUrn.handler.candidates.president==nil then
|
|
||||||
modEUrn.handler.candidates.president = { }
|
|
||||||
end
|
|
||||||
if modEUrn.handler.candidates.president[candidatename]==nil then
|
if modEUrn.handler.candidates.president[candidatename]==nil then
|
||||||
modEUrn.handler.candidates.president[candidatename] = { }
|
modEUrn.handler.candidates.president[candidatename] = { }
|
||||||
end
|
end
|
||||||
|
@ -173,12 +169,16 @@ modEUrn.doPresident = function(playername, candidatename)
|
||||||
if modEUrn.handler.candidates.president[candidatename].voters==nil then
|
if modEUrn.handler.candidates.president[candidatename].voters==nil then
|
||||||
modEUrn.handler.candidates.president[candidatename].voters = { }
|
modEUrn.handler.candidates.president[candidatename].voters = { }
|
||||||
end
|
end
|
||||||
for _, iCandPresident in ipairs(modEUrn.handler.candidates.president) do
|
end
|
||||||
if type(modEUrn.handler.candidates.president[iCandPresident].voters[playername])~="nil" then
|
|
||||||
modEUrn.handler.candidates.president[iCandPresident].voters[playername] = nil
|
end
|
||||||
end
|
|
||||||
end
|
modEUrn.doPresident = function(playername, candidatename)
|
||||||
modEUrn.handler.candidates.president[candidatename].voters[playername] = now
|
if minetest.player_exists(candidatename) then
|
||||||
|
modEUrn.doCheckDataBase(candidatename)
|
||||||
|
modEUrn.handler.elected.president.name = candidatename
|
||||||
|
modEUrn.handler.elected.president.when = os.time() --Em milisegundos
|
||||||
|
modEUrn.doVote(playername, candidatename)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(
|
minetest.chat_send_player(
|
||||||
|
@ -193,29 +193,15 @@ end
|
||||||
|
|
||||||
modEUrn.doPresidentCandidate = function(playername, candidatename, political_campaign)
|
modEUrn.doPresidentCandidate = function(playername, candidatename, political_campaign)
|
||||||
if minetest.player_exists(candidatename) then
|
if minetest.player_exists(candidatename) then
|
||||||
local now = os.time() --Em milisegundos
|
--local now = os.time() --Em milisegundos
|
||||||
if type(political_campaign)~="string"
|
if type(political_campaign)~="string"
|
||||||
or political_campaign == ""
|
or political_campaign == ""
|
||||||
then
|
then
|
||||||
political_campaign = "There are no campaign data about this political candidate."
|
political_campaign = "There are no campaign data about this political candidate."
|
||||||
end
|
end
|
||||||
|
|
||||||
--modEUrn.handler.candidates
|
modEUrn.doCheckDataBase(candidatename)
|
||||||
if modEUrn.handler.candidates==nil then
|
|
||||||
modEUrn.handler.candidates = { }
|
|
||||||
end
|
|
||||||
if modEUrn.handler.candidates.president==nil then
|
|
||||||
modEUrn.handler.candidates.president = { }
|
|
||||||
end
|
|
||||||
if modEUrn.handler.candidates.president[candidatename]==nil then
|
|
||||||
modEUrn.handler.candidates.president[candidatename] = { }
|
|
||||||
end
|
|
||||||
modEUrn.handler.candidates.president[candidatename].political_campaign = political_campaign
|
modEUrn.handler.candidates.president[candidatename].political_campaign = political_campaign
|
||||||
|
|
||||||
if modEUrn.handler.candidates.president[candidatename].voters==nil then
|
|
||||||
modEUrn.handler.candidates.president[candidatename].voters = { }
|
|
||||||
end
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(
|
minetest.chat_send_player(
|
||||||
|
@ -306,34 +292,76 @@ modEUrn.showPresCandCampaign = function(playername, candidatename)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
modEUrn.doUnvote = function(playername)
|
||||||
|
modEUrn.doCheckDataBase(candidatename)
|
||||||
|
for iCandPresName, _ in pairs(modEUrn.handler.candidates.president) do
|
||||||
|
--modEUrn.debug("iCandPresName = "..iCandPresName)
|
||||||
|
if type(modEUrn.handler.candidates.president[iCandPresName].voters[playername])~="nil" then
|
||||||
|
--modEUrn.debug("modEUrn.handler.candidates.president["..iCandPresName.."].voters = "..dump(modEUrn.handler.candidates.president[iCandPresName].voters))
|
||||||
|
modEUrn.handler.candidates.president[iCandPresName].voters[playername] = nil
|
||||||
|
return true, modEUrn.translate("You unvoted for the presidential candidate!")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false, modEUrn.translate("You can't have registered vote!")
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[ ]]
|
||||||
|
modEUrn.doVote = function(playername, candidatename)
|
||||||
|
if type(modEUrn.handler.voters[playername])=="table" then
|
||||||
|
local voterTimePlayed = modEUrn.handler.voters[playername].times.played --in secounds
|
||||||
|
if voterTimePlayed >= modEUrn.MinPlayedHours * (60*60) then
|
||||||
|
if type(candidatename)=="string" and candidatename ~= "" then
|
||||||
|
if minetest.player_exists(candidatename) then
|
||||||
|
if type(modEUrn.handler.candidates.president[candidatename])=="table" then
|
||||||
|
modEUrn.doUnvote(playername)
|
||||||
|
modEUrn.handler.candidates.president[candidatename].voters[playername] = os.time() --Agora em milisegundos
|
||||||
|
return true, modEUrn.translate("You voted for the candidate: ")..core.colorize("#00FF00", candidatename)
|
||||||
|
else
|
||||||
|
return false, modEUrn.translate("Player '%s' is not registered as a candidate for president!"):format(candidatename)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false, modEUrn.translate("The name '%s' is not the player name registered on the server!"):format(candidatename)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false, modEUrn.translate("Please enter the name of the presidential candidate you wish to vote!").."\n"..core.colorize("#888888", "Syntaxe: ")..core.colorize("#00FFFF", "/vote <"..modEUrn.translate("candidate_name")..">")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false, modEUrn.translate("You have not yet played the minimum number of hours to become a presidential voter. (Minimum %02d hours)"):format(modEUrn.MinPlayedHours)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false, modEUrn.translate("Your name is not registered as a voter.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
modEUrn.doCheckPresident = function()
|
modEUrn.doCheckPresident = function()
|
||||||
--Verifica registra quem será o presidente pela maioria de voto do candidato.
|
--Verifica registra quem será o presidente pela maioria de voto do candidato.
|
||||||
if #modEUrn.handler.candidates.president >= 1 then
|
if modEUrn.sortTableLenght(modEUrn.handler.candidates.president) >= 1 then
|
||||||
local maxVotes = 0
|
local maxVotes = 0
|
||||||
local PresMaxVoted = ""
|
local PresMaxVoted = ""
|
||||||
for iCandPresName, _ in pairs(modEUrn.handler.candidates.president) do
|
for iCandPresName, _ in pairs(modEUrn.handler.candidates.president) do
|
||||||
local numVotes = #modEUrn.handler.candidates.president[iCandPresName].voters
|
local numVotes = modEUrn.sortTableLenght(modEUrn.handler.candidates.president[iCandPresName].voters)
|
||||||
if numVotes >= 1 and maxVotes < numVotes then
|
if numVotes >= 1 and maxVotes < numVotes then
|
||||||
maxVotes = numVotes
|
maxVotes = numVotes
|
||||||
PresMaxVoted = iCandPresName
|
PresMaxVoted = iCandPresName
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if maxVotes>=1 and PresMaxVoted~="" then
|
if maxVotes>=1 and PresMaxVoted~="" then
|
||||||
if modEUrn.handler.elected==nil then
|
modEUrn.doCheckDataBase()
|
||||||
modEUrn.handler.elected = { }
|
|
||||||
end
|
|
||||||
if modEUrn.handler.elected.president==nil then
|
|
||||||
modEUrn.handler.elected.president = { }
|
|
||||||
end
|
|
||||||
modEUrn.handler.elected.president.name = PresMaxVoted
|
modEUrn.handler.elected.president.name = PresMaxVoted
|
||||||
modEUrn.handler.elected.president.when = os.time() --Agora em milisegundos
|
modEUrn.handler.elected.president.when = os.time() --Agora em milisegundos
|
||||||
|
|
||||||
|
return true, modEUrn.translate("Player %s has been named the president of this server!"):format(dump(PresMaxVoted))
|
||||||
--[[
|
--[[
|
||||||
Falta:
|
Falta:
|
||||||
* enviar email para todos os jogadores anunciando quem ganhou a eleição do mês.
|
* enviar email para todos os jogadores anunciando quem ganhou a eleição do mês.
|
||||||
* Faze o som de vitória
|
* Faze o som de vitória
|
||||||
--]]
|
--]]
|
||||||
|
else
|
||||||
|
return false, modEUrn.translate("There are no votes registered!")
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
return false, modEUrn.translate("There are no candidates registered!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -389,18 +417,30 @@ minetest.register_on_shutdown(function()
|
||||||
--minetest.log('action',"[E-URN] "..modEUrn.translate("Saving the database from all players in the file '%s'!"):format(modEUrn.urlTabela))
|
--minetest.log('action',"[E-URN] "..modEUrn.translate("Saving the database from all players in the file '%s'!"):format(modEUrn.urlTabela))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
--[[ ]]
|
||||||
minetest.after(3.5, function()
|
minetest.after(3.5, function()
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
--local presname = modEUrn.handler.elected.president.name
|
--local presname = modEUrn.handler.elected.president.name
|
||||||
local presname = modEUrn.getPresidentName()
|
local presname = modEUrn.getPresidentName()
|
||||||
if type(presname)=="string" and presname~="" then
|
if type(presname)=="string" and presname~="" then
|
||||||
local mesAtual = os.date("%m", os.time())
|
local mesAtual = os.date("%m", os.time())
|
||||||
local mesChecked = os.date("%m", tonumber(modEUrn.handler.elected.president.when) or os.time())
|
local mesChecked = os.date("%m", tonumber(modEUrn.handler.elected.president.when))
|
||||||
if mesChecked ~= mesAtual then
|
if mesChecked ~= mesAtual then
|
||||||
modEUrn.doCheckPresident()
|
local result, cause = modEUrn.doCheckPresident()
|
||||||
|
if result == true then
|
||||||
|
minetest.chat_send_all(
|
||||||
|
core.colorize("#00FF00", "[E-URN]").." "..cause
|
||||||
|
)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(
|
||||||
|
playername,
|
||||||
|
core.colorize("#FF0000", "[E-URN]").." "..cause
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
|
|
165
commands.lua
165
commands.lua
|
@ -102,6 +102,49 @@ minetest.register_chatcommand(
|
||||||
|
|
||||||
--############################################################################
|
--############################################################################
|
||||||
|
|
||||||
|
modEUrn.getPropCommDiscandidateMe = function()
|
||||||
|
return {
|
||||||
|
--privs = {electoraljudge=true},
|
||||||
|
params = "[<".. modEUrn.translate("political campaign")..">]",
|
||||||
|
description = modEUrn.translate("Unregister your campaign to run for server president."),
|
||||||
|
func = function(playername, param)
|
||||||
|
if modEUrn.handler.candidates==nil then
|
||||||
|
modEUrn.handler.candidates = { }
|
||||||
|
end
|
||||||
|
if modEUrn.handler.candidates.president==nil then
|
||||||
|
modEUrn.handler.candidates.president = { }
|
||||||
|
end
|
||||||
|
if modEUrn.handler.candidates.president[playername]~=nil then
|
||||||
|
modEUrn.handler.candidates.president[playername] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--modEUrn.handler.elected
|
||||||
|
if modEUrn.handler.elected==nil then
|
||||||
|
modEUrn.handler.elected = { }
|
||||||
|
end
|
||||||
|
if modEUrn.handler.elected.president==nil then
|
||||||
|
modEUrn.handler.elected.president = { }
|
||||||
|
end
|
||||||
|
modEUrn.handler.elected.president.name = ""
|
||||||
|
modEUrn.handler.elected.president.when = 0
|
||||||
|
|
||||||
|
modEUrn.doSave()
|
||||||
|
minetest.chat_send_player(
|
||||||
|
playername,
|
||||||
|
--os.date("%Y-%m-%d %Hh:%Mm:%Ss", now) ..
|
||||||
|
core.colorize("#00FF00", "[E-URN]").." "
|
||||||
|
..modEUrn.translate("Player %s has been unregistered to run as a candidate for president of this server!"):format(dump(playername))
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand(
|
||||||
|
"discandidateme",
|
||||||
|
modEUrn.getPropCommCandidateMe()
|
||||||
|
)
|
||||||
|
--############################################################################
|
||||||
|
|
||||||
modEUrn.getPropCommCandidates = function()
|
modEUrn.getPropCommCandidates = function()
|
||||||
return {
|
return {
|
||||||
--privs = {electoraljudge=true},
|
--privs = {electoraljudge=true},
|
||||||
|
@ -130,21 +173,6 @@ modEUrn.getPropCommCandidates = function()
|
||||||
core.colorize("#00FF00", "[E-URN]").." "
|
core.colorize("#00FF00", "[E-URN]").." "
|
||||||
..modEUrn.translate("Candidate List: %s"):format(candList)
|
..modEUrn.translate("Candidate List: %s"):format(candList)
|
||||||
)
|
)
|
||||||
|
|
||||||
--minetest.chat_send_all("Numero de Candidatos: "..candCount)
|
|
||||||
--minetest.chat_send_all("Lista de Candidatos: "..candList)
|
|
||||||
--]]
|
|
||||||
--[[
|
|
||||||
if then
|
|
||||||
|
|
||||||
minetest.chat_send_player(
|
|
||||||
playername,
|
|
||||||
--os.date("%Y-%m-%d %Hh:%Mm:%Ss", now) ..
|
|
||||||
core.colorize("#00FF00", "[E-URN]").." "
|
|
||||||
..modEUrn.translate("Player %s has been registered to run as a candidate for president of this server!"):format(dump(candidatename))
|
|
||||||
)
|
|
||||||
end
|
|
||||||
--]]
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -177,79 +205,22 @@ minetest.register_chatcommand(
|
||||||
)
|
)
|
||||||
|
|
||||||
--############################################################################
|
--############################################################################
|
||||||
|
--[[ ]]
|
||||||
modEUrn.getPropCommCandVote = function()
|
modEUrn.getPropCommCandVote = function()
|
||||||
return {
|
return {
|
||||||
--privs = {electoraljudge=true},
|
--privs = {electoraljudge=true},
|
||||||
params = "<".. modEUrn.translate("candidate_name")..">",
|
params = "<".. modEUrn.translate("candidate_name")..">",
|
||||||
description = modEUrn.translate("Vote for a specific candidate for president."),
|
description = modEUrn.translate("Vote for a specific candidate for president."),
|
||||||
func = function(playername, candidatename)
|
func = function(playername, candidatename)
|
||||||
if type(modEUrn.handler.voters[playername])=="table" then
|
local resulte, cause = modEUrn.doVote(playername, candidatename)
|
||||||
local voterTimePlayed = modEUrn.handler.voters[playername].times.played --in secounds
|
local color = "#FF0000"
|
||||||
if voterTimePlayed >= modEUrn.MinPlayedHours * (60*60) then
|
if resulte then
|
||||||
|
color = "#00FF00"
|
||||||
if type(candidatename)=="string" and candidatename ~= "" then
|
end
|
||||||
if minetest.player_exists(candidatename) then
|
minetest.chat_send_player(
|
||||||
if type(modEUrn.handler.candidates.president[candidatename])=="table" then
|
playername,
|
||||||
--modEUrn.MinPlayedHours
|
core.colorize(color, "[E-URN]").." "..cause
|
||||||
--modEUrn.handler.voters[playername].times.played
|
)
|
||||||
|
|
||||||
for iCandPresName, _ in pairs(modEUrn.handler.candidates.president) do
|
|
||||||
--modEUrn.debug("iCandPresName = "..iCandPresName)
|
|
||||||
if type(modEUrn.handler.candidates.president[iCandPresName].voters[playername])~="nil" then
|
|
||||||
--modEUrn.debug("modEUrn.handler.candidates.president["..iCandPresName.."].voters = "..dump(modEUrn.handler.candidates.president[iCandPresName].voters))
|
|
||||||
modEUrn.handler.candidates.president[iCandPresName].voters[playername] = nil
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
modEUrn.handler.candidates.president[candidatename].voters[playername] = os.time() --Agora em milisegundos
|
|
||||||
|
|
||||||
|
|
||||||
minetest.chat_send_player(
|
|
||||||
playername,
|
|
||||||
core.colorize("#00FF00", "[E-URN]").." "
|
|
||||||
..modEUrn.translate("You voted for the candidate: ")
|
|
||||||
..core.colorize("#00FF00", candidatename)
|
|
||||||
)
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(
|
|
||||||
playername,
|
|
||||||
core.colorize("#FF0000", "[E-URN]").." "
|
|
||||||
..modEUrn.translate("Player '%s' is not registered as a candidate for president!"):format(candidatename)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(
|
|
||||||
playername,
|
|
||||||
core.colorize("#FF0000", "[E-URN]").." "
|
|
||||||
..modEUrn.translate("The name '%s' is not the player name registered on the server!"):format(candidatename)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(
|
|
||||||
playername,
|
|
||||||
core.colorize("#FF0000", "[E-URN]").." "
|
|
||||||
..modEUrn.translate("Please enter the name of the presidential candidate you wish to vote!").."\n"
|
|
||||||
..core.colorize("#888888", "Syntaxe: ")
|
|
||||||
..core.colorize("#00FFFF",
|
|
||||||
"/vote <"..modEUrn.translate("candidate_name")..">"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(
|
|
||||||
playername,
|
|
||||||
core.colorize("#FF0000", "[E-URN]").." "
|
|
||||||
..modEUrn.translate("You have not yet played the minimum number of hours to become a presidential voter. (Minimum %02d hours)"):format(modEUrn.MinPlayedHours)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(
|
|
||||||
playername,
|
|
||||||
core.colorize("#FF0000", "[E-URN:ERRO]").." "
|
|
||||||
..modEUrn.translate("Your name is not registered as a voter.")
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -258,6 +229,7 @@ minetest.register_chatcommand(
|
||||||
"vote",
|
"vote",
|
||||||
modEUrn.getPropCommCandVote()
|
modEUrn.getPropCommCandVote()
|
||||||
)
|
)
|
||||||
|
--]]
|
||||||
|
|
||||||
--############################################################################
|
--############################################################################
|
||||||
|
|
||||||
|
@ -327,6 +299,35 @@ minetest.register_chatcommand(
|
||||||
|
|
||||||
--############################################################################
|
--############################################################################
|
||||||
|
|
||||||
|
modEUrn.getPropCommElection = function()
|
||||||
|
return {
|
||||||
|
privs = {electoraljudge=true},
|
||||||
|
--params = "<".. modEUrn.translate("candidate_name")..">",
|
||||||
|
description = modEUrn.translate("Apply presidential selection vote counting! Need the 'electoraljudge' privilege."),
|
||||||
|
func = function(playername, param)
|
||||||
|
--modEUrn.debug("modEUrn.handler.candidates.president = "..dump(modEUrn.handler.candidates.president))
|
||||||
|
--modEUrn.debug("modEUrn.sortTableLenght(modEUrn.handler.candidates.president) = "..modEUrn.sortTableLenght(modEUrn.handler.candidates.president))
|
||||||
|
local result, cause = modEUrn.doCheckPresident()
|
||||||
|
if result == true then
|
||||||
|
minetest.chat_send_all(
|
||||||
|
core.colorize("#00FF00", "[E-URN]").." "..cause
|
||||||
|
)
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(
|
||||||
|
playername,
|
||||||
|
core.colorize("#FF0000", "[E-URN]").." "..cause
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_chatcommand(
|
||||||
|
"election",
|
||||||
|
modEUrn.getPropCommElection()
|
||||||
|
)
|
||||||
|
--############################################################################
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
minetest.register_chatcommand(
|
minetest.register_chatcommand(
|
||||||
"t",
|
"t",
|
||||||
|
|
Loading…
Add table
Reference in a new issue