From 73bf1e08bb86843a20fd339e7c39ad716e854cc2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 31 Jul 2016 21:21:53 +0200 Subject: Mark entry as viewed when switching tabs --- init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index db35883..8fcecd8 100644 --- a/init.lua +++ b/init.lua @@ -241,14 +241,20 @@ function doc.process_form(player,formname,fields) if fields.doc_header ~= nil then local tab = tonumber(fields.doc_header) local formspec, subformname, contents + local cid, eid + cid = doc.data.players[playername].category + eid = doc.data.players[playername].entry if(tab==1) then contents = doc.formspec_main() subformname = "main" elseif(tab==2) then - contents = doc.formspec_category(doc.data.players[playername].category, playername) + contents = doc.formspec_category(cid, playername) subformname = "category" elseif(tab==3) then - contents = doc.formspec_entry(doc.data.players[playername].category, doc.data.players[playername].entry) + contents = doc.formspec_entry(cid, eid) + if cid ~= nil and eid ~= nil then + doc.mark_entry_as_viewed(playername, cid, eid) + end subformname = "entry" end formspec = doc.formspec_core(tab)..contents -- cgit v1.2.3