diff options
author | Wuzzy <almikes@aol.com> | 2016-08-01 16:40:26 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-08-01 16:40:26 +0200 |
commit | 1cd7d63b9d993b6524033ec0207a1133213d2ec3 (patch) | |
tree | 672168b2a07a20e8206df026e322e02ae984b87e | |
parent | 9ebc54df507e27a32aa6c5c2e1403c6e920be158 (diff) |
Add achievement for reading block entries
-rw-r--r-- | depends.txt | 1 | ||||
-rw-r--r-- | init.lua | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/depends.txt b/depends.txt index 8e695ec..aca8d05 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ doc +awards? @@ -694,3 +694,28 @@ local function gather_descs() end minetest.after(0, gather_descs) + +local awardchecktime = 0 +if minetest.get_modpath("awards") ~= nil then + -- TODO: Change the goal to unlocking/discovering all block entries of Minetest Game + -- (excluding unused blocks like default:cloud) + awards.register_achievement("doc_minetest_game_allnodes", { + title = "Block Index Completed", + description = "Read all help entries about blocks.", + }) + + -- TODO: Test this when the awards mod works again + minetest.register_globalstep(function(dtime) + -- Check awards every 30 seconds + awardchecktime = awardchecktime + dtime + if awardchecktime < 30 then return end + awardchecktime = 30 - awardchecktime + local players = minetest.get_connected_players() + for p=1,#players do + local count = doc.get_viewed_count(players[p]:get_player_name(), "nodes") + if count ~= nil and count >= doc.get_entry_count("nodes") then + awards.unlock("doc_minetest_game_allnodes") + end + end + end) +end |