From 0dc819a15708b5aefcf63609af08ab52470c20d2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 31 Jul 2016 21:04:33 +0200 Subject: Update viewed entry status directly after access --- init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index f5e78b4..db35883 100644 --- a/init.lua +++ b/init.lua @@ -45,6 +45,8 @@ function doc.mark_entry_as_viewed(playername, category_id, entry_id) doc.data.players[playername].stored_data.viewed[category_id] = {} end doc.data.players[playername].stored_data.viewed[category_id][entry_id] = true + -- Needed because viewed entries get a different color + doc.data.players[playername].entry_textlist_needs_updating = true end -- Returns true if the specified entry has been viewed by the player @@ -133,7 +135,9 @@ end function doc.generate_entry_list(cid, playername) local formstring - if doc.data.players[playername].entry_textlist == nil or doc.data.players[playername].category ~= cid then + if doc.data.players[playername].entry_textlist == nil + or doc.data.players[playername].category ~= cid + or doc.data.players[playername].entry_textlist_needs_updating == true then local entry_textlist = "textlist[0,1;11,7;doc_catlist;" local counter = 0 doc.data.players[playername].entry_ids = {} @@ -161,6 +165,7 @@ function doc.generate_entry_list(cid, playername) entry_textlist = entry_textlist .. "]" doc.data.players[playername].entry_textlist = entry_textlist formstring = entry_textlist + doc.data.players[playername].entry_testlist_needs_updating = false else formstring = doc.data.players[playername].entry_textlist end -- cgit v1.2.3