summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
Diffstat (limited to 'api.lua')
-rw-r--r--api.lua18
1 files changed, 13 insertions, 5 deletions
diff --git a/api.lua b/api.lua
index c399770..444b4ba 100644
--- a/api.lua
+++ b/api.lua
@@ -35,11 +35,10 @@ end
-- A table of award definitions
awards.def = {}
-function awards.tbv(tb,value)
- awards.tbv_default(tb,value,{})
-end
-
-function awards.tbv_default(tb,value,default)
+function awards.tbv(tb,value,default)
+ if not default then
+ default = {}
+ end
if not tb or type(tb) ~= "table" then
if not value then
value = "[NULL]"
@@ -58,6 +57,15 @@ function awards.tbv_default(tb,value,default)
end
end
+function awards.assertPlayer(playern)
+ awards.tbv(awards.players, playern)
+ awards.tbv(awards.players[playern], "name", playern)
+ awards.tbv(awards.players[playern], "unlocked")
+ awards.tbv(awards.players[playern], "place")
+ awards.tbv(awards.players[playern], "count")
+ awards.tbv(awards.players[playern], "deaths", 0)
+end
+
-- Load files
dofile(minetest.get_modpath("awards").."/triggers.lua")
dofile(minetest.get_modpath("awards").."/config.txt")