mirror of
https://gitlab.com/lunovox/e-urn.git
synced 2025-03-15 07:21:22 +00:00
This commit is contained in:
parent
68454c2124
commit
379f726442
2 changed files with 17 additions and 23 deletions
20
api.lua
20
api.lua
|
@ -144,29 +144,35 @@ end
|
|||
|
||||
modEUrn.doCheckDataBase = function(candidatename)
|
||||
--modEUrn.handler.elected
|
||||
if modEUrn.handler.elected==nil then
|
||||
if type(modEUrn.handler.elected)=="nil" then
|
||||
modEUrn.handler.elected = { }
|
||||
end
|
||||
if modEUrn.handler.elected.president==nil then
|
||||
if type(modEUrn.handler.elected.president)=="nil" then
|
||||
modEUrn.handler.elected.president = { }
|
||||
end
|
||||
if type(modEUrn.handler.elected.president.name)=="nil" then
|
||||
modEUrn.handler.elected.president.name = ""
|
||||
end
|
||||
if type(modEUrn.handler.elected.president.when)=="nil" then
|
||||
modEUrn.handler.elected.president.when = 0
|
||||
end
|
||||
|
||||
--modEUrn.handler.candidates
|
||||
if modEUrn.handler.candidates==nil then
|
||||
if type(modEUrn.handler.candidates)=="nil" then
|
||||
modEUrn.handler.candidates = { }
|
||||
end
|
||||
if modEUrn.handler.candidates.president==nil then
|
||||
if type(modEUrn.handler.candidates.president)=="nil" then
|
||||
modEUrn.handler.candidates.president = { }
|
||||
end
|
||||
|
||||
if type(candidatename)=="string" and candidatename~="" then
|
||||
if modEUrn.handler.candidates.president[candidatename]==nil then
|
||||
if type(modEUrn.handler.candidates.president[candidatename])=="nil" then
|
||||
modEUrn.handler.candidates.president[candidatename] = { }
|
||||
end
|
||||
if modEUrn.handler.candidates.president[candidatename].political_campaign==nil then
|
||||
if type(modEUrn.handler.candidates.president[candidatename].political_campaign)=="nil" then
|
||||
modEUrn.handler.candidates.president[candidatename].political_campaign = "There are no campaign data about this political candidate."
|
||||
end
|
||||
if modEUrn.handler.candidates.president[candidatename].voters==nil then
|
||||
if type(modEUrn.handler.candidates.president[candidatename].voters)=="nil" then
|
||||
modEUrn.handler.candidates.president[candidatename].voters = { }
|
||||
end
|
||||
end
|
||||
|
|
20
commands.lua
20
commands.lua
|
@ -105,26 +105,14 @@ minetest.register_chatcommand(
|
|||
modEUrn.getPropCommDiscandidateMe = function()
|
||||
return {
|
||||
--privs = {electoraljudge=true},
|
||||
params = "[<".. modEUrn.translate("political campaign")..">]",
|
||||
--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
|
||||
modEUrn.doCheckDataBase()
|
||||
|
||||
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
|
||||
|
||||
|
@ -141,7 +129,7 @@ end
|
|||
|
||||
minetest.register_chatcommand(
|
||||
"discandidateme",
|
||||
modEUrn.getPropCommCandidateMe()
|
||||
modEUrn.getPropCommDiscandidateMe()
|
||||
)
|
||||
--############################################################################
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue