mirror of
https://gitlab.com/lunovox/e-urn.git
synced 2025-03-15 07:21:22 +00:00
This commit is contained in:
parent
af26b86f2a
commit
e5684c5747
2 changed files with 19 additions and 2 deletions
17
api.lua
17
api.lua
|
@ -4,12 +4,11 @@ minetest.register_privilege("electoraljudge", {
|
|||
})
|
||||
|
||||
modEUrn.handler = {
|
||||
--[[ ]]
|
||||
elected = {
|
||||
president = {
|
||||
name = "", --name of the elected candidate.
|
||||
when = 0, --when the candidate was elected.
|
||||
voters = { }, --names of voters who voted for this elected candidate.
|
||||
--voters = { }, --names of voters who voted for this elected candidate.
|
||||
},
|
||||
},
|
||||
candidates = {
|
||||
|
@ -262,6 +261,20 @@ 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))
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if type(formname)~="string" and formname == "eurn" then
|
||||
local playername = player:get_player_name()
|
||||
if type(fields.txtCampaign)=="string"
|
||||
and (
|
||||
type(fields.key_enter) ~= "nil"
|
||||
or type(fields.btnSave) ~= "nil"
|
||||
)
|
||||
then
|
||||
modEUrn.doPresidentCandidate(playername, playername, fields.txtCampaign)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.after(3.5, function()
|
||||
minetest.register_globalstep(function(dtime)
|
||||
local presname = modEUrn.handler.elected.president.name
|
||||
|
|
|
@ -214,6 +214,10 @@ minetest.register_chatcommand(
|
|||
"campaign",
|
||||
modEUrn.getPropCommCandCampaign()
|
||||
)
|
||||
minetest.register_chatcommand(
|
||||
"candidate",
|
||||
modEUrn.getPropCommCandCampaign()
|
||||
)
|
||||
|
||||
--############################################################################
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue