diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-04-04 20:55:33 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-04-04 20:55:33 +0100 |
commit | f571f9d6eb7b11dc003aaf6c0a19b9db40ad356e (patch) | |
tree | c07efef45cfdecdec19b817d339be251ca926ac1 /triggers.lua | |
parent | 6c79a2f73fdf5f2a7e79da0f0291e61f7239f2ee (diff) |
Add support for death reasons
Diffstat (limited to 'triggers.lua')
-rw-r--r-- | triggers.lua | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/triggers.lua b/triggers.lua index 9721b38..6f39cf3 100644 --- a/triggers.lua +++ b/triggers.lua @@ -14,13 +14,6 @@ -- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -- -awards.register_trigger("death", { - type = "counted", - progress = "@1/@2 deaths", - auto_description = { "Die once", "Die @1 times" }, -}) -minetest.register_on_dieplayer(awards.notify_death) - awards.register_trigger("chat", { type = "counted", @@ -45,6 +38,25 @@ awards.register_trigger("join", { minetest.register_on_joinplayer(awards.notify_join) +awards.register_trigger("death", { + type = "counted_key", + progress = "@1/@2 deaths", + auto_description = { "Die once of @2", "Die @1 times of @2" }, + auto_description_total = { "Die @1 times.", "Mine @1 times" }, + get_key = function(self, def) + return def.trigger.reason + end, +}) +minetest.register_on_dieplayer(function(player, reason) + if reason then + reason = reason.type + else + reason = "unknown" + end + awards.notify_death(player, reason) +end) + + awards.register_trigger("dig", { type = "counted_key", progress = "@1/@2 dug", |