From c456bf1d292c1d093e29975db8ba00c359615245 Mon Sep 17 00:00:00 2001 From: "A. Demant" Date: Tue, 15 Jan 2019 04:32:15 +0100 Subject: [PATCH] add new element playtime --- config.lua | 2 +- register.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.lua b/config.lua index 20a7471..4ac2347 100644 --- a/config.lua +++ b/config.lua @@ -18,7 +18,7 @@ xpfw.hud_intern={} xpfw.attrib_recreates={} for i,attr in ipairs({"walked","distance","swam","login","dug","build","deaths","spoke","killed_mobs","killed_player", - "logon","craft"}) do + "logon","craft","playtime"}) do xpfw.register_attribute(attr,{min=0,max=math.huge,default=0,hud=1}) end for i,attr in ipairs({"lastlogin"}) do diff --git a/register.lua b/register.lua index 89e6f4c..357eca4 100644 --- a/register.lua +++ b/register.lua @@ -120,6 +120,10 @@ minetest.register_globalstep(function(dtime) if playerdata ~= nil then playerdata.dtime=playerdata.dtime+dtime playerdata.gtimer1=playerdata.gtimer1+dtime + + -- add dtime to playtime of user + xpfw.player_add_attribute(player,"playtime",dtime) + local act_pos=player:get_pos() -- calculating distance to last known position if playerdata.last_pos ~= nil then