Add check for nyancat mod before registering the award

Fixes #44
This commit is contained in:
rubenwardy 2018-04-04 23:01:50 +01:00
parent 0017a174bd
commit 7f156db0df
4 changed files with 23 additions and 17 deletions

@ -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 -- Mini Miner
awards.register_achievement("award_mine2", { awards.register_achievement("award_mine2", {
title = S("Mini Miner"), title = S("Mini Miner"),
@ -907,3 +894,18 @@ minetest.after(0, function()
}, },
}) })
end) 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

@ -11,3 +11,4 @@ vessels?
moreblocks? moreblocks?
fire? fire?
flowers? flowers?
nyancat?

@ -39,10 +39,13 @@ function awards.get_formspec(name, to, sid)
local def = awards.registered_awards[item.name] local def = awards.registered_awards[item.name]
if def and def.secret and not item.got then if def and def.secret and not item.got then
formspec = formspec .. "label[1,2.75;"..minetest.formspec_escape(S("(Secret Award)")).."]".. formspec = formspec .. "label[1,2.75;"..
"image[1,0;3,3;awards_unknown.png]" minetest.formspec_escape(S("(Secret Award)")).."]"..
"image[1,0;3,3;awards_unknown.png]"
if def and def.description then 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 end
else else
local title = item.name local title = item.name

@ -2,7 +2,7 @@ name = awards
title = Achievements title = Achievements
author = rubenwardy author = rubenwardy
description = Adds achievements to Minetest, and an API to register new ones. 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 license = MIT
forum = https://forum.minetest.net/viewtopic.php?t=4870 forum = https://forum.minetest.net/viewtopic.php?t=4870
version = 3.0.0 version = 3.0.0