Bugfixes after test with Skylar!

This commit is contained in:
Nathan Schneider
2021-12-21 18:12:59 -07:00
parent 956f9a2635
commit 9a2c72c6a1
13 changed files with 71 additions and 16 deletions

View File

@ -9,6 +9,7 @@ local localdir = minetest.get_modpath("modpol") .. "/modpol_minetest"
--overrides
dofile (localdir .. "/overrides/interactions.lua")
dofile (localdir .. "/overrides/users.lua")
--testing command for "singleplayer"
function modpol.msg(text)

View File

@ -35,7 +35,6 @@ regchat(
privs = {privs=true},
func = function(user)
modpol.orgs.reset()
modpol.instance:add_member(user)
modpol.interactions.dashboard(user)
return true, "Reset orgs"
end,

View File

@ -53,9 +53,10 @@ function modpol.interactions.dashboard(user)
local user_pending_count = 0
for k,v in ipairs(modpol.orgs.array) do
if v.pending and v.pending[user] then
modpol.msg(v.name)
table.insert(user_pending, v.name)
user_pending_count = user_pending_count + 1
if modpol.util.num_pairs(v.pending[user]) ~= 0 then
table.insert(user_pending, v.name)
user_pending_count = user_pending_count + 1
end
end
end
@ -169,7 +170,7 @@ function modpol.interactions.org_dashboard(user, org_string)
"label[0.5,1;Parent: "..parent..membership_toggle(parent).."]",
"label[0.5,2;Members:]",
"dropdown[2,1.5;7,0.8;user_orgs;"..formspec_list(org.members)..";;]",
"label[0.5,3;Children:]",
"label[0.5,3;Child orgs:]",
"dropdown[2,2.5;7,0.8;children;"..formspec_list(children)..";;]",
"label[0.5,4;Modules:]",
"dropdown[2,3.5;7,0.8;modules;"..formspec_list(modules)..";;]",

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Function: modpol.list_users(org)
-- Overwrites function at /users.lua
-- Params:
-- if nil, lists instance members; if an org name, lists its members
-- Output: a table with names of players currently in the game
modpol.list_users = function(org)
local users = {}
if (org == nil) then -- no specified org; all players
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
table.insert(users,name)
end
else -- if an org is specified
if (modpol.orgs[org] ~= nil) then -- org exists
users = modpol.orgs[org]["members"]
end
end
return users
end