From 2c28a0fc26ef02ca80458f0267f172803094d51d Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sat, 30 Sep 2023 12:51:18 +0200 Subject: [PATCH] local function grey_if_zero --- fs_add_quest_steps.lua | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/fs_add_quest_steps.lua b/fs_add_quest_steps.lua index 7698b59..773280b 100644 --- a/fs_add_quest_steps.lua +++ b/fs_add_quest_steps.lua @@ -1,3 +1,13 @@ +-- helper function to make unintresting zeros in tables less visible +local grey_if_zero = function(fs, n) + if(n and n == 0) then + table.insert(fs, "#444444") + else + table.insert(fs, "#FFFFFF") + end + table.insert(fs, minetest.formspec_escape(n)) +end + -- This order imposed here on the quest steps is the one in which the -- quest steps have to be solved - as far as we can tell (the quest -- may be in the process of beeing created and not logicly complete yet). @@ -253,15 +263,6 @@ end -- small helper function for yl_speak_up.get_fs_add_quest_steps; -- lists all the quest steps found in liste in the order they occour there yl_speak_up.quest_step_list_show_table = function(formspec, table_specs, liste, data, required_for_steps) - local grey_if_zero = function(fs, n) - if(n and n == 0) then - table.insert(fs, "#444444") - else - table.insert(fs, "#FFFFFF") - end - table.insert(fs, minetest.formspec_escape(n)) - end - table.insert(formspec, "tablecolumns[".. "color;text,align=right;".. -- #d.one_step_required "color;text,align=right;".. -- #d.all_steps_required @@ -324,15 +325,6 @@ end -- lists npc that are either already added or could be added -- can also handle locations yl_speak_up.quest_npc_show_table = function(formspec, table_specs, liste, step_data, is_location_list) - local grey_if_zero = function(fs, n) - if(n and n == 0) then - table.insert(fs, "#444444") - else - table.insert(fs, "#FFFFFF") - end - table.insert(fs, minetest.formspec_escape(n)) - end - table.insert(formspec, "tablecolumns[".. "color;text,align=right;".. -- used in this many quest steps "color;text,align=left;".. -- n_id (number, for NPC) or p_(-185,3,-146) (for locations)