From ac6bae3f85c7b42b048aca077f847c9733774067 Mon Sep 17 00:00:00 2001 From: Nathan Schneider Date: Sun, 14 Mar 2021 22:51:53 -0600 Subject: [PATCH] Added modpol.menu() functions modpol and modpol_minetest. Not sure if latter works. --- README.md | 16 +++++++++++----- modpol/interactions/interactions.lua | 14 ++++++++++++++ modpol/modpol.lua | 1 - modpol_minetest/chatcommands/chatcommands.lua | 12 ++++++++++++ .../overrides/interactions/interactions.lua | 15 ++++++++++++++- 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a982acc..3b7a145 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/modpol/interactions/interactions.lua b/modpol/interactions/interactions.lua index 85feeb4..35ab67c 100644 --- a/modpol/interactions/interactions.lua +++ b/modpol/interactions/interactions.lua @@ -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) diff --git a/modpol/modpol.lua b/modpol/modpol.lua index b0d2ce7..0035a09 100644 --- a/modpol/modpol.lua +++ b/modpol/modpol.lua @@ -70,7 +70,6 @@ modpol.load_storage() -- =================================================================== -- ModPol core features - dofile (topdir .. "/api.lua") diff --git a/modpol_minetest/chatcommands/chatcommands.lua b/modpol_minetest/chatcommands/chatcommands.lua index 4c848e4..774c044 100644 --- a/modpol_minetest/chatcommands/chatcommands.lua +++ b/modpol_minetest/chatcommands/chatcommands.lua @@ -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 diff --git a/modpol_minetest/overrides/interactions/interactions.lua b/modpol_minetest/overrides/interactions/interactions.lua index 34560fe..eaf9dff 100644 --- a/modpol_minetest/overrides/interactions/interactions.lua +++ b/modpol_minetest/overrides/interactions/interactions.lua @@ -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) \ No newline at end of file +end)