mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-11-15 07:00:26 +01:00
77 lines
2.1 KiB
Lua
77 lines
2.1 KiB
Lua
local S = minetest.get_translator(minetest.get_current_modname())
|
|
|
|
local all_meals = {}
|
|
|
|
for itemname, def in pairs(minetest.registered_items) do
|
|
--"df_farming:"..item_name.."_"..recipe_type.name.."_meal"
|
|
if string.sub(itemname, 1, 11) == "df_farming:" and string.sub(itemname, -5, -1) == "_meal" then
|
|
local meal_name = string.sub(itemname, 12, -1)
|
|
local meal_desc = def.description
|
|
local image = string.sub(def.inventory_image, 1, -7) .. "32.png"
|
|
|
|
awards.register_achievement("dfcaverns_meal_"..meal_name, {
|
|
title = S("Eat @1", meal_desc),
|
|
description = S("One of the many delights that can be crafted only from fungal growths found deep underground."),
|
|
icon = image,
|
|
trigger = {
|
|
type = "eat",
|
|
item = itemname,
|
|
target = 1
|
|
},
|
|
})
|
|
table.insert(all_meals, "dfcaverns_meal_"..meal_name)
|
|
end
|
|
end
|
|
|
|
local test_list = df_achievements.test_list
|
|
-- name is the player name
|
|
-- def is the award def.
|
|
awards.register_on_unlock(function(player_name, def)
|
|
local player_awards = awards.player(player_name)
|
|
if not player_awards or not player_awards.unlocked then
|
|
return
|
|
end
|
|
local unlocked = player_awards.unlocked
|
|
test_list(player_name, "dfcaverns_gourmand", unlocked, all_meals)
|
|
end)
|
|
|
|
awards.register_achievement("dfcaverns_gourmand", {
|
|
title = S("Subterranean Gourmand"),
|
|
description = S("Eat one of each of the various meals that can be cooked from underground ingredients."),
|
|
--icon =,
|
|
})
|
|
|
|
if minetest.get_modpath("df_primordial_items") then
|
|
awards.register_achievement("dfcaverns_primordial_fruit", {
|
|
title = S("Eat a Primordial Fruit"),
|
|
description = S(""),
|
|
--icon =,
|
|
trigger = {
|
|
type = "eat",
|
|
item = "df_primordial_items:primordial_fruit",
|
|
target = 1
|
|
},
|
|
})
|
|
|
|
awards.register_achievement("dfcaverns_glowtato", {
|
|
title = S("Eat a Glowtato"),
|
|
description = S(""),
|
|
--icon =,
|
|
trigger = {
|
|
type = "eat",
|
|
item = "df_primordial_items:glowtato",
|
|
target = 1
|
|
},
|
|
})
|
|
|
|
-- awards.register_achievement("dfcaverns_diced_mushroom", {
|
|
-- title = S("Eat Diced Mushroom"),
|
|
-- description = S(""),
|
|
-- --icon =,
|
|
-- trigger = {
|
|
-- type = "eat",
|
|
-- item = "df_primordial_items:diced_mushroom",
|
|
-- target = 1
|
|
-- },
|
|
-- })
|
|
end |