From 97d540715ac583767aed8d6b6707ca6c8af4416d Mon Sep 17 00:00:00 2001 From: Nathan Schneider Date: Tue, 3 Aug 2021 22:14:01 -0600 Subject: [PATCH] Fixed bug preventing second formspecs from showing in sequences of interactions --- modpol/tests/nested_functions.lua | 4 +--- modpol_minetest/overrides/interactions/interactions.lua | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modpol/tests/nested_functions.lua b/modpol/tests/nested_functions.lua index 74106fc..914d68f 100644 --- a/modpol/tests/nested_functions.lua +++ b/modpol/tests/nested_functions.lua @@ -27,7 +27,5 @@ request_id = test_org:make_request(add_josh) print('\nHave the two members vote on it') modpol.interactions.org_dashboard("nathan","test_org") -modpol.interactions.org_dashboard("nathan","test_org") +modpol.interactions.org_dashboard("luke","test_org") - --- check a member's dashboard for the process, try to initialize it diff --git a/modpol_minetest/overrides/interactions/interactions.lua b/modpol_minetest/overrides/interactions/interactions.lua index 1a60789..4cd37cc 100644 --- a/modpol_minetest/overrides/interactions/interactions.lua +++ b/modpol_minetest/overrides/interactions/interactions.lua @@ -3,7 +3,7 @@ -- CONTEXTUAL STUFF -- ================ --- First, set up contexts to enable passing across formspecs +-- _contexts to enable passing across formspecs -- https://rubenwardy.com/minetest_modding_book/en/players/formspecs.html#contexts local _contexts = {} @@ -252,7 +252,6 @@ minetest.register_on_player_receive_fields(function (player, formname, fields) if formname == "modpol:text_query" then local pname = player:get_player_name() local input = fields.input - minetest.close_formspec(pname, formname) if not input then -- no input, do nothing else @@ -263,6 +262,7 @@ minetest.register_on_player_receive_fields(function (player, formname, fields) modpol.interactions.message(pname, "text_query: " .. input) end end + minetest.close_formspec(pname, formname) end end) @@ -291,7 +291,6 @@ minetest.register_on_player_receive_fields(function (player, formname, fields) if formname == "modpol:dropdown_query" then local pname = player:get_player_name() local choice = fields.input - minetest.close_formspec(pname, formname) local func = _contexts[pname]["dropdown_query_func"] if not choice then -- no choice, do nothing @@ -300,6 +299,7 @@ minetest.register_on_player_receive_fields(function (player, formname, fields) else modpol.interactions.message(pname, "dropdown_query: " .. choice) end + minetest.close_formspec(pname, formname) end end) @@ -339,12 +339,12 @@ minetest.register_on_player_receive_fields(function (player, formname, fields) if fields.yes then vote = fields.yes elseif fields.no then vote = fields.no end - minetest.close_formspec(pname, formname) if vote then modpol.interactions.message(pname, "Voted " .. vote) local func = _contexts[pname]["binary_poll_func"] func(vote) end + minetest.close_formspec(pname, formname) end end)