Changed Minetest module listing to remove slugs, retain only names

This commit is contained in:
Nathan Schneider 2021-12-20 20:06:17 -07:00
parent b9317490fb
commit 645cc6f690
2 changed files with 18 additions and 14 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -134,8 +134,7 @@ function modpol.interactions.org_dashboard(user, org_string)
if org.modules then if org.modules then
for k,v in pairs(org.modules) do for k,v in pairs(org.modules) do
if not v.hide then -- hide utility modules if not v.hide then -- hide utility modules
local module_entry = v.name.. local module_entry = v.name
" ["..v.slug.."]"
table.insert(modules, module_entry) table.insert(modules, module_entry)
end end
end end
@ -204,18 +203,23 @@ minetest.register_on_player_receive_fields(function (player, formname, fields)
-- Receiving modules -- Receiving modules
elseif fields.modules elseif fields.modules
and fields.modules ~= "View..." then and fields.modules ~= "View..." then
local module = string.match( local module = nil
fields.modules,"%[(.*)%]") for k,v in pairs(org.modules) do
modpol.interactions.binary_poll_user( if fields.modules == v.name then
pname, module = v
modpol.modules[module].name..":\n".. end end
modpol.modules[module].desc.."\n".. if module then
"Proceed?", modpol.interactions.binary_poll_user(
function(input) pname,
if input == "Yes" then module.name..":\n"..
org:call_module(module, pname) module.desc.."\n"..
end "Proceed?",
end) function(input)
if input == "Yes" then
org:call_module(module.slug, pname)
end
end)
end
-- Receiving pending -- Receiving pending
elseif fields.pending elseif fields.pending