show date instead of timestamp of when the npc was first seen in the npc list

This commit is contained in:
Sokomine 2023-07-22 10:15:28 +02:00
parent 922b7fa32b
commit 9c022cb7eb

View File

@ -49,7 +49,7 @@ yl_speak_up.update_npc_data = function(self, dialog, force_store)
trades = old.trades
end
local created_at = 0
if(is_known) then
if(is_known and yl_speak_up.npc_list[self.yl_speak_up.id].created_at) then
created_at = yl_speak_up.npc_list[self.yl_speak_up.id].created_at
else
created_at = os.time()
@ -332,7 +332,10 @@ yl_speak_up.get_fs_show_npc_list = function(pname, selected_row)
table.concat(prop_list, ',')..';;]'
end
end
-- TODO is_generic
local first_seen_at = '- unknown -'
if(data.created_at and data.created_at ~= "") then
first_seen_at = minetest.formspec_escape(os.date("%m/%d/%y", data.created_at))
end
-- TODO edit, visit button
info_current_row =
'container[0.1,11.2]'..
@ -341,9 +344,9 @@ yl_speak_up.get_fs_show_npc_list = function(pname, selected_row)
'label[0.1,0.5;Typ:]'..
'label[3.0,0.5;'..
minetest.formspec_escape(tostring(data.typ or '- ? -'))..']'..
'label[10.1,0.5;First seen at:]'..
'label[13.1,0.5;'..
minetest.formspec_escape(tostring(data.created_at or '- ? -'))..']'..
'label[11.1,0.5;First seen at:]'..
'label[13.4,0.5;'..
first_seen_at..']'..
'label[0.1,1.0;Can be edited by:]'..
'label[3.0,1.0;'..
minetest.formspec_escape(table.concat(edit_list, ', '))..']'..