Special formspec for empty categories

This commit is contained in:
Wuzzy 2016-08-04 02:21:15 +02:00
parent 98d093ca1b
commit 37ff2dd620

View File

@ -282,11 +282,15 @@ function doc.formspec_category(id, playername)
formstring = formstring .. "button[0,1;3,1;doc_button_goto_main;Go to category list]" formstring = formstring .. "button[0,1;3,1;doc_button_goto_main;Go to category list]"
else else
formstring = "label[0,0;Help > "..doc.data.categories[id].def.name.."]" formstring = "label[0,0;Help > "..doc.data.categories[id].def.name.."]"
formstring = formstring .. "label[0,0.5;This category has the following entries:]" if doc.get_entry_count(id) >= 1 then
formstring = formstring .. doc.generate_entry_list(id, playername) formstring = formstring .. "label[0,0.5;This category has the following entries:]"
formstring = formstring .. "button[0,8;3,1;doc_button_goto_entry;Show entry]" formstring = formstring .. doc.generate_entry_list(id, playername)
formstring = formstring .. "label[8,8;Number of entries: "..doc.get_entry_count(id).."\n" formstring = formstring .. "button[0,8;3,1;doc_button_goto_entry;Show entry]"
formstring = formstring .. "New entries: "..(doc.get_entry_count(id)-doc.get_viewed_count(playername, id)).."]" formstring = formstring .. "label[8,8;Number of entries: "..doc.get_entry_count(id).."\n"
formstring = formstring .. "New entries: "..(doc.get_entry_count(id)-doc.get_viewed_count(playername, id)).."]"
else
formstring = formstring .. "label[0,0.5;This category is empty.]"
end
end end
return formstring return formstring
end end