summaryrefslogtreecommitdiff
path: root/gui.lua
diff options
context:
space:
mode:
Diffstat (limited to 'gui.lua')
-rw-r--r--gui.lua24
1 files changed, 22 insertions, 2 deletions
diff --git a/gui.lua b/gui.lua
index e8745d8..b6f1084 100644
--- a/gui.lua
+++ b/gui.lua
@@ -1,8 +1,28 @@
local S = awards.gettext
+local function order_awards(name)
+ local done = {}
+ local retval = {}
+ local player = awards.player(name)
+ if player and player.unlocked then
+ for _,got in pairs(player.unlocked) do
+ if awards.def[got] then
+ done[got] = true
+ table.insert(retval,{name=got,got=true})
+ end
+ end
+ end
+ for _,def in pairs(awards.def) do
+ if not done[def.name] then
+ table.insert(retval,{name=def.name,got=false})
+ end
+ end
+ return retval
+end
+
function awards.get_formspec(name, to, sid)
local formspec = ""
- local listofawards = awards._order_awards(name)
+ local listofawards = order_awards(name)
local playerdata = awards.player(name)
if #listofawards == 0 then
@@ -103,7 +123,7 @@ function awards.show_to(name, to, sid, text)
return
end
if text then
- local listofawards = awards._order_awards(name)
+ local listofawards = order_awards(name)
if #listofawards == 0 then
minetest.chat_send_player(to, S("Error: No awards available."))
return