From 7f156db0df8a77793635a32db5aee474a5c26eea Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 4 Apr 2018 23:01:50 +0100 Subject: [PATCH] Add check for nyancat mod before registering the award Fixes #44 --- awards.lua | 28 +++++++++++++++------------- depends.txt | 1 + gui.lua | 9 ++++++--- mod.conf | 2 +- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/awards.lua b/awards.lua index a6e9784..ccf9e2e 100644 --- a/awards.lua +++ b/awards.lua @@ -347,19 +347,6 @@ if minetest.get_modpath("default") then } }) - -- Found a Nyan cat! - awards.register_achievement("award_nyanfind", { - secret = true, - title = S("A Cat in a Pop-Tart?!"), - description = S("Mine a nyan cat."), - icon = "nyancat_front.png", - trigger = { - type = "dig", - node = "default:nyancat", - target = 1 - } - }) - -- Mini Miner awards.register_achievement("award_mine2", { title = S("Mini Miner"), @@ -907,3 +894,18 @@ minetest.after(0, function() }, }) end) + +if minetest.get_modpath("nyancat") then + -- Found a Nyan cat! + awards.register_achievement("award_nyanfind", { + secret = true, + title = S("A Cat in a Pop-Tart?!"), + description = S("Mine a nyan cat."), + icon = "nyancat_front.png", + trigger = { + type = "dig", + node = "nyancat:nyancat", + target = 1 + } + }) +end diff --git a/depends.txt b/depends.txt index c0de3af..c8f3f2d 100644 --- a/depends.txt +++ b/depends.txt @@ -11,3 +11,4 @@ vessels? moreblocks? fire? flowers? +nyancat? diff --git a/gui.lua b/gui.lua index a6d6147..35fde59 100644 --- a/gui.lua +++ b/gui.lua @@ -39,10 +39,13 @@ function awards.get_formspec(name, to, sid) local def = awards.registered_awards[item.name] if def and def.secret and not item.got then - formspec = formspec .. "label[1,2.75;"..minetest.formspec_escape(S("(Secret Award)")).."]".. - "image[1,0;3,3;awards_unknown.png]" + formspec = formspec .. "label[1,2.75;".. + minetest.formspec_escape(S("(Secret Award)")).."]".. + "image[1,0;3,3;awards_unknown.png]" if def and def.description then - formspec = formspec .. "textarea[0.25,3.25;4.8,1.7;;"..minetest.formspec_escape(S("Unlock this award to find out what it is."))..";]" + formspec = formspec .. "textarea[0.25,3.25;4.8,1.7;;".. + minetest.formspec_escape( + S("Unlock this award to find out what it is."))..";]" end else local title = item.name diff --git a/mod.conf b/mod.conf index 59fb9d8..c853e9b 100644 --- a/mod.conf +++ b/mod.conf @@ -2,7 +2,7 @@ name = awards title = Achievements author = rubenwardy description = Adds achievements to Minetest, and an API to register new ones. -optional_depends = intllib,sfinv,unified_inventory,default,stairs,farming,dye,beds,wool,vessels,moreblocks,fire,flowers +optional_depends = intllib,sfinv,unified_inventory,default,stairs,farming,dye,beds,wool,vessels,moreblocks,fire,flowers,nyancat license = MIT forum = https://forum.minetest.net/viewtopic.php?t=4870 version = 3.0.0