From 85a40d24880964dfdf6c3e0db92ce5b9bbca0dc5 Mon Sep 17 00:00:00 2001 From: MrIbby Date: Wed, 1 Jun 2016 10:41:24 -0700 Subject: Add craft trigger --- api.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'api.lua') diff --git a/api.lua b/api.lua index e201cb5..ea3c86e 100644 --- a/api.lua +++ b/api.lua @@ -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 -- cgit v1.2.3