Added modpol.menu() functions modpol and modpol_minetest. Not sure if latter works.

This commit is contained in:
Nathan Schneider 2021-03-14 22:51:53 -06:00
parent 8faca7931a
commit ac6bae3f85
5 changed files with 51 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# modpol: Modular Politics Prototype for Minetest
# Modular Politics Prototype for Minetest
This is a mod for [Minetest](https://minetest.net) that enables diverse governance mechanisms. It seeks to implement the [Modular Politics](https://metagov.org/modpol) proposal. Ideally, in the future, it
will be possible to use this framework to simulate governance in a
@ -20,6 +20,8 @@ $ lua
> dofile("modpol.lua")
```
For a list of global functions and tables, use `modpol.menu()`.
## Minetest
To use this in Minetest, simply install it as a Minetest mod. Minetest
@ -42,7 +44,8 @@ By default, a data directory named "data" will be created in this director
Another storage method may be chosen in modpol.lua. A StorageRef-based method for Minetest 5.* is included: storage-mod_storage.lua.
## Stand-alone Modular Politics
## Standalone Modular Politics
To separate the Modular Politics core from the Minetest mod, simply remove these files:
@ -58,13 +61,16 @@ depends.txt
Eventually the stand-alone modpol package will be published as a separate repo.
## Authorship
## Credits
Initiated by [Nathan Schneider](https://nathanschneider.info) of the [Media Enterprise Design Lab](https://colorado.edu/lab/medlab) at the University of Colorado Boulder, as part of the [Metagovernance Project](https://metagov.org). Based on the paper "[Modular Politics: Toward a Governance Layer for Online Communities](https://metagov.org/modpol)."
We'd love to have more contributors, particularly from the Minetest community! Please join the conversation in the [Issues](https://gitlab.com/medlabboulder/modpol/-/issues) or the [Minetest.net forum](https://forum.minetest.net/viewtopic.php?f=47&t=26037).
Thanks to contributors:
Thanks to contributors: Robert Kiraly [[OldCoder](https://github.com/oldcoder/)] (ocutils.lua, storage-local.lua, project refactoring), [MisterE](https://gitlab.com/gbrrudmin) (project refactoring, core feature development)
* [MisterE](https://gitlab.com/gbrrudmin) (project refactoring, core feature development)
* Robert Kiraly [[OldCoder](https://github.com/oldcoder/)] (ocutils.lua, storage-local.lua, project refactoring)
We'd love to welcome more contributors, particularly from the Minetest community! Please join the conversation in the [Issues](https://gitlab.com/medlabboulder/modpol/-/issues) or the [Minetest.net forum](https://forum.minetest.net/viewtopic.php?f=47&t=26037).
## Licenses

View File

@ -3,6 +3,20 @@
-- User interaction functions for Modular Politics
-- Called by modpol.lua
-- ===================================================================
-- Function: modpol.menu(user)
-- Params: user (string)
-- Q: Should this return a menu of commands relevant to the specific user?
-- Output: Displays a menu of commands to the user
-- TKTK currently just prints all of modpol---needs major improvement
modpol.menu = function(user)
local output = "Command list:\n"
for key,value in pairs(modpol) do
output = output .. "- modpol." .. key .. "\n"
end
print(output)
end
-- ===================================================================
-- Function: modpol.binary_poll_user(user, question)
-- Params: user (string), question (string)

View File

@ -70,7 +70,6 @@ modpol.load_storage()
-- ===================================================================
-- ModPol core features
dofile (topdir .. "/api.lua")

View File

@ -7,6 +7,18 @@ local regchat -- Chat-command registration function
regchat = minetest.register_chatcommand
-- ===================================================================
-- /menu
-- Presents a menu of options to users
minetest.register_chatcommand(
"menu", {
privs = {},
func = function(user)
local result = modpol.menu(user)
return true, result
end,
})
-- ===================================================================
-- /addorg /add_org
-- This code defines a chat command which creates a new

View File

@ -1,4 +1,17 @@
-- ===================================================================
-- Function: modpol.menu(user)
-- Params: user (string)
-- Q: Should this return a menu of commands relevant to the specific user?
-- Output: Displays a menu of commands to the user
-- TKTK currently a manually curated list---needs major improvement
modpol.menu = function(user)
local output = "Command list:"
for key,value in pairs(chat_table) do
output = output .. "/" .. key .. "\n"
end
return output
end
-- ===================================================================
-- Function: modpol.binary_poll_user(user, question)
@ -41,4 +54,4 @@ modpol.binary_poll_user = function(user, question)
else -- if the form is not a recognized name
return
end
end)
end)