diff options
author | MrIbby <siribby@outlook.com> | 2016-06-01 10:41:24 -0700 |
---|---|---|
committer | rubenwardy <rubenwardy@gmail.com> | 2016-06-01 18:41:24 +0100 |
commit | 85a40d24880964dfdf6c3e0db92ce5b9bbca0dc5 (patch) | |
tree | 726d22eb8a4f18e0a2bdd115a3d24927204dde81 /api.lua | |
parent | c711bc74b25e7f9acf445d7a8df5241d771e0b04 (diff) |
Add craft triggerv0.5.0
Diffstat (limited to 'api.lua')
-rw-r--r-- | api.lua | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -65,6 +65,7 @@ function awards.assertPlayer(playern) awards.tbv(awards.players[playern], "unlocked") awards.tbv(awards.players[playern], "place") awards.tbv(awards.players[playern], "count") + awards.tbv(awards.players[playern], "craft") awards.tbv(awards.players[playern], "deaths", 0) awards.tbv(awards.players[playern], "joins", 0) awards.tbv(awards.players[playern], "chats", 0) @@ -117,6 +118,13 @@ function awards.register_achievement(name,data_table) target = data_table.trigger.target, } table.insert(awards.onPlace,tmp) + elseif data_table.trigger.type == "craft" then + local tmp = { + award = name, + item = data_table.trigger.item, + target = data_table.trigger.target, + } + table.insert(awards.onCraft,tmp) elseif data_table.trigger.type == "death" then local tmp = { award = name, @@ -181,6 +189,11 @@ function awards.register_onJoin(func) table.insert(awards.onJoin,func) end +-- run a function when an item is crafted +function awards.register_onCraft(func) + table.insert(awards.onCraft,func) +end + -- This function is called whenever a target condition is met. -- It checks if a player already has that achievement, and if they do not, -- it gives it to them |