diff options
author | Wuzzy <wuzzy2@mail.ru> | 2016-11-15 01:57:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-15 01:57:01 +0100 |
commit | 38c504e938e169e0337591b7ffe13863ff21250d (patch) | |
tree | e35f4fdc8eda2f3eb67f2ee7bf806bbe7304efff /api.lua | |
parent | ab7206e15050b050257c7e45b804dc9b1352d41d (diff) |
Add eat trigger, extend existing triggers, add 9 awards (#35)
* Add eat trigger and 2 new awards
* Add mushroom eating awards
* Add support for counting any eat/dig/craft/place
* Update readme
* Add 4 builder awards
* Update German locale
* Update dependencies
* Fix mistake in German translation
* Revert removal of background
Diffstat (limited to 'api.lua')
-rw-r--r-- | api.lua | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -115,6 +115,22 @@ function awards.get_item_count(data, field, itemname) end end +function awards.get_total_item_count(data, field) + local i = 0 + if data and field then + awards.assertPlayer(data) + awards.tbv(data, field) + for mod,_ in pairs(data[field]) do + awards.tbv(data[field], mod) + for item,_ in pairs(data[field][mod]) do + awards.tbv(data[field][mod], item, 0) + i = i + data[field][mod][item] + end + end + end + return i +end + function awards.register_on_unlock(func) table.insert(awards.on_unlock, func) end |