*Reorganized code so that further expansion is possible in a very organized manner.

*modpol.add_member() -- added a check if the member is already a member of that organized

*storage -- fixed bug by moving storageref to top of file

*added on_joinplayer to add players to instance

*moved minetest specific code in init.lua to modpol_minetest, organized in folders.
All overrides in one folder, all chatcommands in another, the on_joinplayer in modpol_minetest/orgs/instance.lua
This commit is contained in:
MisterE123
2021-02-10 23:40:28 -05:00
parent c05023ad20
commit f19796f82d
20 changed files with 395 additions and 286 deletions
+25
View File
@@ -0,0 +1,25 @@
-- ===================================================================
-- /orgs.lua
-- User interaction functions for Modular Politics
-- Called by modpol.lua
-- ===================================================================
-- Function: modpol.binary_poll_user(user, question)
-- Params: user (string), question (string)
-- Output:
-- presents a yes/no/abstain poll to a user, returns answer
modpol.binary_poll_user = function(user, question)
local query = "Poll for " .. user .. " (y/n/a): ".. question
local answer
repeat
print(query)
answer = io.read()
until answer == "y" or answer == "n" or answer == "a"
if answer == "y" then
return "Yes"
elseif answer == "n" then
return "No"
else
return "Abstain"
end
end