local function grey_if_zero

This commit is contained in:
Sokomine 2023-09-30 12:51:18 +02:00
parent feae914e85
commit 2c28a0fc26

View File

@ -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)