mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-12-25 18:30:36 +01:00
hook into awards' trigger system to get "x/y" progress displayed for the multi-achievement achievements
This commit is contained in:
parent
a2c72faff3
commit
e2867ad2c4
@ -20,7 +20,7 @@ awards.register_achievement("dfcaverns_destroyed_gas_seep", {
|
||||
|
||||
awards.register_achievement("dfcaverns_giant_web", {
|
||||
title = S("Collect Giant Webbing"),
|
||||
description = S(""),
|
||||
description = S("Collect a piece of giant webbing found in a cave."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^big_webs_item.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
@ -45,113 +45,109 @@ awards.register_achievement("dfcaverns_giant_web", {
|
||||
|
||||
awards.register_achievement("dfcaverns_cave_pearls", {
|
||||
title = S("Collect Cave Pearls"),
|
||||
description = S(""),
|
||||
description = S("Collect some cave pearls from the wall of a cave."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^dfcaverns_cave_pearls_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "df_mapitems:cave_pearls",
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_prospector"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_castle_coral", {
|
||||
title = S("Collect Castle Coral"),
|
||||
description = S(""),
|
||||
description = S("Collect a piece of Castle Coral from the Sunless Sea."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^dfcaverns_castle_coral_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "df_mapitems:castle_coral",
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_prospector"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_ruby_crystals", {
|
||||
title = S("Collect Giant Red Crystal"),
|
||||
description = S(""),
|
||||
description = S("Collect one of the giant red crystals found in large barren caverns."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^dfcaverns_big_red_crystal_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "group:dfcaverns_big_crystal",
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_prospector"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_cave_coral", {
|
||||
title = S("Collect Cave Coral"),
|
||||
description = S(""),
|
||||
description = S("Collect a piece of Cave Coral from the Sunless Sea."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^dfcaverns_cave_coral_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "group:dfcaverns_cave_coral",
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_prospector"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_flawless_mese", {
|
||||
title = S("Collect Flawless Mese Crystal Block"),
|
||||
description = S(""),
|
||||
description = S("Collect a flawless Mese crystal block from the Magma Sea."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^dfcaverns_glowmese_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "df_mapitems:glow_mese",
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_prospector"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_luminous_salt", {
|
||||
title = S("Collect Luminous Salt Crystal"),
|
||||
description = S(""),
|
||||
description = S("Collect a luminous salt crystal from the dry caverns where Bloodthorns live."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^dfcaverns_salt_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "df_mapitems:salt_crystal",
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_prospector"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_glow_amethyst", {
|
||||
title = S("Collect Glowing Amethyst"),
|
||||
description = S(""),
|
||||
description = S("Collect a block of glowing amethyst crystal from the Underworld."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^dfcaverns_amethyst_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "df_underworld_items:glow_amethyst",
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_prospector"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_glow_stone", {
|
||||
title = S('"Collect" Lightseam Stone'),
|
||||
description = S(""),
|
||||
description = S("Attempt to collect a piece of Lightseam, a strange glowing mineral found deep underground."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^dfcaverns_glowstone_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
node = "df_underworld_items:glowstone",
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_prospector"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_prospector", {
|
||||
title = S("Deep Prospector"),
|
||||
description = S(""),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..crossed_pick_and_shovel.."^dfcaverns_awards_foregroundx32.png",
|
||||
})
|
||||
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
--"dfcaverns_prospector"
|
||||
local prospector_achievements = {"dfcaverns_castle_coral", "dfcaverns_cave_coral", "dfcaverns_cave_pearls", "dfcaverns_flawless_mese", "dfcaverns_glow_amethyst", "dfcaverns_glow_stone", "dfcaverns_luminous_salt", "dfcaverns_ruby_crystals"}
|
||||
|
||||
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_prospector", unlocked, prospector_achievements)
|
||||
end)
|
||||
awards.register_achievement("dfcaverns_prospector", {
|
||||
title = S("Deep Prospector"),
|
||||
description = S("Collect various different exotic items from various caverns."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..crossed_pick_and_shovel.."^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_prospector",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_prospector"),
|
||||
},
|
||||
})
|
||||
|
@ -15,27 +15,48 @@ end
|
||||
|
||||
local plant_node_achievements =
|
||||
{
|
||||
["df_trees:black_cap_sapling"] = {achievement="dfcaverns_plant_black_cap", title=S("Plant Black Cap"), desc=S(""), icon=make_texture("dfcaverns_black_cap_sapling.png", coal_ore)},
|
||||
["df_trees:fungiwood_sapling"] = {achievement="dfcaverns_plant_fungiwood", title=S("Plant Fungiwood"), desc=S(""), icon=make_texture("dfcaverns_fungiwood_sapling.png")},
|
||||
["df_trees:goblin_cap_sapling"] = {achievement="dfcaverns_plant_goblin_cap", title=S("Plant Goblin Cap"), desc=S(""), icon=make_texture("dfcaverns_goblin_cap_sapling.png")},
|
||||
["df_trees:nether_cap_sapling"] = {achievement="dfcaverns_plant_nethercap", title=S("Plant @1", nethercap_name), desc=S(""), icon=make_texture("dfcaverns_nether_cap_sapling.png", ice_texture)},
|
||||
["df_trees:spore_tree_sapling"] = {achievement="dfcaverns_plant_spore_tree", title=S("Plant Spore Tree"), desc=S(""), icon=make_texture("dfcaverns_spore_tree_sapling.png")},
|
||||
["df_trees:tower_cap_sapling"] = {achievement="dfcaverns_plant_tower_cap", title=S("Plant Tower Cap"), desc=S(""), icon=make_texture("dfcaverns_tower_cap_sapling.png")},
|
||||
["df_trees:tunnel_tube_sapling"] = {achievement="dfcaverns_plant_tunnel_tube", title=S("Plant Tunnel Tube"), desc=S(""), icon=make_texture("dfcaverns_tunnel_tube_sapling.png")},
|
||||
["df_trees:torchspine_ember"] = {achievement="dfcaverns_plant_torchspine", title=S("Plant Torchspine"), desc=S(""), icon=make_texture("dfcaverns_torchspine_achievement.png", coal_ore)},
|
||||
["df_trees:spindlestem_seedling"] = {achievement="dfcaverns_plant_spindlestem", title=S("Plant Spindlestem"), desc=S(""), icon=make_texture("dfcaverns_spindlestem_achievement.png")},
|
||||
["df_trees:blood_thorn"] = {achievement="dfcaverns_plant_bloodthorn", title=S("Plant Bloodthorn"), desc=S(""), icon=make_texture("dfcaverns_bloodthorn_achievement.png")},
|
||||
["df_primordial_items:giant_hypha_apical_meristem"] = {achievement="dfcaverns_plant_giant_mycelium", title=S("Plant Primordial Mycelium"), desc=S(""), icon=make_texture("dfcaverns_mush_soil.png"), secret = true,},
|
||||
["df_primordial_items:fern_sapling"] = {achievement="dfcaverns_plant_primordial_fern", title=S("Plant Primordial Fern"), desc=S(""), icon=make_texture("dfcaverns_jungle_fern_03.png"), secret = true,},
|
||||
["df_primordial_items:jungle_mushroom_sapling"] = {achievement="dfcaverns_plant_primordial_jungle_mushroom", title=S("Plant Primordial Jungle Mushroom"), desc=S(""), icon=make_texture("dfcaverns_jungle_mushroom_02.png"), secret = true,},
|
||||
["df_primordial_items:jungletree_sapling"] = {achievement="dfcaverns_plant_primordial_jungletree", title=S("Plant Primordial Jungle Tree"), desc=S(""), icon=make_texture("dfcaverns_jungle_sapling.png"), secret = true,},
|
||||
["df_primordial_items:mush_sapling"] = {achievement="dfcaverns_plant_primordial_mushroom", title=S("Plant Primordial Mushroom"), desc=S(""), icon=make_texture("dfcaverns_mush_sapling.png"), secret = true,},
|
||||
["df_farming:cave_wheat_seed"] = {achievement="dfcaverns_plant_cave_wheat", title=S("Plant Cave Wheat"), desc=S(""), icon=make_texture("dfcaverns_cave_wheat_8.png")},
|
||||
["df_farming:dimple_cup_seed"] = {achievement="dfcaverns_plant_dimple_cup", title=S("Plant Dimple Cup"), desc=S(""), icon=make_texture("dfcaverns_dimple_cup_4.png")},
|
||||
["df_farming:pig_tail_seed"] = {achievement="dfcaverns_plant_pig_tail", title=S("Plant Pig Tail"), desc=S(""), icon=make_texture("dfcaverns_pig_tail_8.png")},
|
||||
["df_farming:plump_helmet_spawn"] = {achievement="dfcaverns_plant_plump_helmet", title=S("Plant Plump Helmet"), desc=S(""), icon=make_texture("dfcaverns_plump_helmet_achievement.png")},
|
||||
["df_farming:quarry_bush_seed"] = {achievement="dfcaverns_plant_quarry_bush", title=S("Plant Quarry Bush"), desc=S(""), icon=make_texture("dfcaverns_quarry_bush_5.png")},
|
||||
["df_farming:sweet_pod_seed"] = {achievement="dfcaverns_plant_sweet_pod", title=S("Plant Sweet Pod"), desc=S(""), icon=make_texture("dfcaverns_sweet_pod_6.png")},
|
||||
["df_trees:black_cap_sapling"] = {achievement="dfcaverns_plant_black_cap",
|
||||
title=S("Plant Black Cap"), desc=S(""), icon=make_texture("dfcaverns_black_cap_sapling.png", coal_ore), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:fungiwood_sapling"] = {achievement="dfcaverns_plant_fungiwood",
|
||||
title=S("Plant Fungiwood"), desc=S(""), icon=make_texture("dfcaverns_fungiwood_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:goblin_cap_sapling"] = {achievement="dfcaverns_plant_goblin_cap",
|
||||
title=S("Plant Goblin Cap"), desc=S(""), icon=make_texture("dfcaverns_goblin_cap_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:nether_cap_sapling"] = {achievement="dfcaverns_plant_nethercap",
|
||||
title=S("Plant @1", nethercap_name), desc=S(""), icon=make_texture("dfcaverns_nether_cap_sapling.png", ice_texture), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:spore_tree_sapling"] = {achievement="dfcaverns_plant_spore_tree",
|
||||
title=S("Plant Spore Tree"), desc=S(""), icon=make_texture("dfcaverns_spore_tree_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:tower_cap_sapling"] = {achievement="dfcaverns_plant_tower_cap",
|
||||
title=S("Plant Tower Cap"), desc=S(""), icon=make_texture("dfcaverns_tower_cap_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:tunnel_tube_sapling"] = {achievement="dfcaverns_plant_tunnel_tube",
|
||||
title=S("Plant Tunnel Tube"), desc=S(""), icon=make_texture("dfcaverns_tunnel_tube_sapling.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:torchspine_ember"] = {achievement="dfcaverns_plant_torchspine",
|
||||
title=S("Plant Torchspine"), desc=S(""), icon=make_texture("dfcaverns_torchspine_achievement.png", coal_ore), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:spindlestem_seedling"] = {achievement="dfcaverns_plant_spindlestem",
|
||||
title=S("Plant Spindlestem"), desc=S(""), icon=make_texture("dfcaverns_spindlestem_achievement.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_trees:blood_thorn"] = {achievement="dfcaverns_plant_bloodthorn",
|
||||
title=S("Plant Bloodthorn"), desc=S(""), icon=make_texture("dfcaverns_bloodthorn_achievement.png"), _dfcaverns_achievements={"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_primordial_items:giant_hypha_apical_meristem"] = {achievement="dfcaverns_plant_giant_mycelium",
|
||||
title=S("Plant Primordial Mycelium"), desc=S(""), icon=make_texture("dfcaverns_mush_soil.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_primordial_items:fern_sapling"] = {achievement="dfcaverns_plant_primordial_fern",
|
||||
title=S("Plant Primordial Fern"), desc=S(""), icon=make_texture("dfcaverns_jungle_fern_03.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_primordial_items:jungle_mushroom_sapling"] = {achievement="dfcaverns_plant_primordial_jungle_mushroom",
|
||||
title=S("Plant Primordial Jungle Mushroom"), desc=S(""), icon=make_texture("dfcaverns_jungle_mushroom_02.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_primordial_items:jungletree_sapling"] = {achievement="dfcaverns_plant_primordial_jungletree",
|
||||
title=S("Plant Primordial Jungle Tree"), desc=S(""), icon=make_texture("dfcaverns_jungle_sapling.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_primordial_items:mush_sapling"] = {achievement="dfcaverns_plant_primordial_mushroom",
|
||||
title=S("Plant Primordial Mushroom"), desc=S(""), icon=make_texture("dfcaverns_mush_sapling.png"), secret = true, _dfcaverns_achievements={"dfcaverns_plant_all_primordial", "dfcaverns_plant_all_underground_trees"}},
|
||||
["df_farming:cave_wheat_seed"] = {achievement="dfcaverns_plant_cave_wheat",
|
||||
title=S("Plant Cave Wheat"), desc=S(""), icon=make_texture("dfcaverns_cave_wheat_8.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}},
|
||||
["df_farming:dimple_cup_seed"] = {achievement="dfcaverns_plant_dimple_cup",
|
||||
title=S("Plant Dimple Cup"), desc=S(""), icon=make_texture("dfcaverns_dimple_cup_4.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}},
|
||||
["df_farming:pig_tail_seed"] = {achievement="dfcaverns_plant_pig_tail",
|
||||
title=S("Plant Pig Tail"), desc=S(""), icon=make_texture("dfcaverns_pig_tail_8.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}},
|
||||
["df_farming:plump_helmet_spawn"] = {achievement="dfcaverns_plant_plump_helmet",
|
||||
title=S("Plant Plump Helmet"), desc=S(""), icon=make_texture("dfcaverns_plump_helmet_achievement.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}},
|
||||
["df_farming:quarry_bush_seed"] = {achievement="dfcaverns_plant_quarry_bush",
|
||||
title=S("Plant Quarry Bush"), desc=S(""), icon=make_texture("dfcaverns_quarry_bush_5.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}},
|
||||
["df_farming:sweet_pod_seed"] = {achievement="dfcaverns_plant_sweet_pod",
|
||||
title=S("Plant Sweet Pod"), desc=S(""), icon=make_texture("dfcaverns_sweet_pod_6.png"), _dfcaverns_achievements={"dfcaverns_plant_all_farmables"}},
|
||||
}
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||
@ -55,69 +76,60 @@ minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack
|
||||
end
|
||||
end)
|
||||
|
||||
--"dfcaverns_plant_all_farmables",
|
||||
local all_farmable_achievements = {"dfcaverns_plant_cave_wheat", "dfcaverns_plant_dimple_cup", "dfcaverns_plant_pig_tail", "dfcaverns_plant_plump_helmet", "dfcaverns_plant_quarry_bush", "dfcaverns_plant_sweet_pod",}
|
||||
--"dfcaverns_plant_all_primordial",
|
||||
local all_primordial_achievements = {"dfcaverns_plant_giant_mycelium", "dfcaverns_plant_primordial_fern", "dfcaverns_plant_primordial_jungle_mushroom", "dfcaverns_plant_primordial_jungletree", "dfcaverns_plant_primordial_mushroom",}
|
||||
--"dfcaverns_plant_all_underground_trees",
|
||||
local all_underground_trees_achievements = {"dfcaverns_plant_all_upper_trees", "dfcaverns_plant_all_primordial"}
|
||||
--"dfcaverns_plant_all_upper_trees",
|
||||
local all_upper_trees = {"dfcaverns_plant_black_cap", "dfcaverns_plant_fungiwood", "dfcaverns_plant_goblin_cap", "dfcaverns_plant_nethercap", "dfcaverns_plant_spore_tree", "dfcaverns_plant_tower_cap", "dfcaverns_plant_tunnel_tube", "dfcaverns_plant_torchspine","dfcaverns_plant_spindlestem"}
|
||||
|
||||
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_plant_all_farmables", unlocked, all_farmable_achievements)
|
||||
test_list(player_name, "dfcaverns_plant_all_primordial", unlocked, all_primordial_achievements)
|
||||
test_list(player_name, "dfcaverns_plant_all_underground_trees", unlocked, all_underground_trees_achievements)
|
||||
test_list(player_name, "dfcaverns_plant_all_upper_trees", unlocked, all_upper_trees)
|
||||
end)
|
||||
|
||||
for _, def in pairs(plant_node_achievements) do
|
||||
awards.register_achievement(def.achievement, {
|
||||
title = def.title,
|
||||
description = def.desc,
|
||||
icon = def.icon,
|
||||
secret = def.secret,
|
||||
_dfcaverns_achievements = def._dfcaverns_achievements,
|
||||
})
|
||||
end
|
||||
|
||||
awards.register_achievement("dfcaverns_plant_all_upper_trees", {
|
||||
title = S("Plant All Fungal Tree Types"),
|
||||
description = S(""),
|
||||
title = S("Plant All Fungal Trees"),
|
||||
description = S("Plant one of every kind of 'tree' found in the caverns above the Sunless Sea."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"
|
||||
.."(dfcaverns_awards_cavern_towercapx32.png^dfcaverns_awards_cavern_fungiwoodx32.png^dfcaverns_awards_cavern_goblincapx32.png)^[transformFX"
|
||||
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_plant_all_upper_trees",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_plant_all_upper_trees"),
|
||||
},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_plant_all_primordial", {
|
||||
title = S("Plant All Primordial Tree Types"),
|
||||
description = S(""),
|
||||
title = S("Plant All Primordial Trees"),
|
||||
description = S("Plant one of every kind of 'tree' from the Primordial caverns."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"
|
||||
.."(dfcaverns_awards_cavern_primordial_mushx32.png^dfcaverns_awards_cavern_junglex32.png)^[transformFX"
|
||||
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
|
||||
secret = true,
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_plant_all_primordial",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_plant_all_primordial"),
|
||||
},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_plant_all_underground_trees", {
|
||||
title = S("Plant All Underground Tree Types"),
|
||||
description = S(""),
|
||||
title = S("Plant All Underground Trees"),
|
||||
description = S("Plant one of every kind of 'tree' found in the caverns beneath the surface."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"
|
||||
.."(dfcaverns_awards_cavern_towercapx32.png^dfcaverns_awards_cavern_fungiwoodx32.png^dfcaverns_awards_cavern_goblincapx32.png)^[transformFX"
|
||||
.. "^dfcaverns_awards_cavern_primordial_mushx32.png^dfcaverns_awards_cavern_junglex32.png"
|
||||
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_plant_all_underground_trees",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_plant_all_underground_trees"),
|
||||
},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_plant_all_farmables", {
|
||||
title = S("Plant All Farmable Underground Plants"),
|
||||
description = S(""),
|
||||
description = S("Plant one of every kind of small farmable plant found in the caverns beneath the surface."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png"
|
||||
.."^[combine:32x32:0,0="..soil_texture
|
||||
.."^[combine:32x32:0,16="..soil_texture
|
||||
@ -129,4 +141,9 @@ awards.register_achievement("dfcaverns_plant_all_farmables", {
|
||||
.."^[combine:32x32:0,16=dfcaverns_sweet_pod_6.png"
|
||||
.."^[combine:32x32:16,16=dfcaverns_quarry_bush_5.png"
|
||||
.."^[combine:32x32:16,15="..hoe_texture.."^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_plant_all_farmables",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_plant_all_farmables"),
|
||||
},
|
||||
})
|
@ -1,7 +1,5 @@
|
||||
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
|
||||
@ -18,8 +16,8 @@ for itemname, def in pairs(minetest.registered_items) do
|
||||
item = itemname,
|
||||
target = 1
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_gourmand"},
|
||||
})
|
||||
table.insert(all_meals, "dfcaverns_meal_"..meal_name)
|
||||
end
|
||||
end
|
||||
|
||||
@ -32,26 +30,19 @@ awards.register_achievement("dfcaverns_meal_dwarven_bread", {
|
||||
type = "eat",
|
||||
item = "df_farming:cave_bread",
|
||||
target = 1,
|
||||
}
|
||||
},
|
||||
_dfcaverns_achievements = {"dfcaverns_gourmand"},
|
||||
})
|
||||
table.insert(all_meals, "dfcaverns_meal_dwarven_bread")
|
||||
|
||||
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("Dwarven Gourmand"),
|
||||
description = S("Eat one of each of the various meals that can be cooked from underground ingredients."),
|
||||
icon ="dfcaverns_awards_backgroundx32.png^dfcaverns_prepared_food28x32.png^dfcaverns_gourmand_achievement.png^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_gourmand",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_gourmand"),
|
||||
}
|
||||
})
|
||||
|
||||
if minetest.get_modpath("df_primordial_items") then
|
||||
|
@ -7,28 +7,71 @@ if not minetest.get_modpath("awards") then
|
||||
end
|
||||
|
||||
df_achievements = {}
|
||||
local achievement_parents = {}
|
||||
df_achievements.get_child_achievement_count = function(parent_achievement)
|
||||
return #achievement_parents[parent_achievement]
|
||||
end
|
||||
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local nethercap_name = df_dependencies.nethercap_name
|
||||
local register_achievement_old = awards.register_achievement
|
||||
awards.register_achievement = function(achievement_name, achievement_def, ...)
|
||||
register_achievement_old(achievement_name, achievement_def, ...)
|
||||
|
||||
if achievement_def._dfcaverns_achievements then
|
||||
for _, parent_achievement in pairs(achievement_def._dfcaverns_achievements) do
|
||||
local parent_source_list = achievement_parents[parent_achievement] or {}
|
||||
achievement_parents[parent_achievement] = parent_source_list
|
||||
table.insert(parent_source_list, achievement_name)
|
||||
minetest.debug(achievement_name .. " added to list for " .. parent_achievement)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- used to track the progress of achievements that are based off of other achievements
|
||||
awards.register_trigger("dfcaverns_achievements", {
|
||||
type="counted_key",
|
||||
progress = "@1/@2", -- awards seems to use a conflicting syntax with internationalization, ick. Avoid words here.
|
||||
get_key = function(self, def)
|
||||
return def.trigger.achievement_name
|
||||
end,
|
||||
})
|
||||
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
-- used in a few places in this mod
|
||||
df_achievements.test_list = function(player_name, target_achievement, unlocked, target_list)
|
||||
if unlocked[target_achievement] == target_achievement then
|
||||
return
|
||||
|
||||
|
||||
awards.register_on_unlock(function(player_name, def)
|
||||
local def_dfcaverns_achievements = def._dfcaverns_achievements
|
||||
if not def_dfcaverns_achievements then return end
|
||||
local player_awards = awards.player(player_name)
|
||||
if not player_awards then return end
|
||||
local unlocked = player_awards.unlocked
|
||||
if not unlocked then return end
|
||||
--local player = minetest.get_player_by_name(player_name)
|
||||
--if not player then return end
|
||||
|
||||
-- the achievement that just got unlocked had one or more "parent" achievements associated with it.
|
||||
for _, achievement_parent in pairs(def_dfcaverns_achievements) do
|
||||
minetest.debug("updating achievement type " .. achievement_parent)
|
||||
--if unlocked[achievement_parent] ~= achievement_parent then -- this should theoretically never fail
|
||||
player_awards.dfcaverns_achievements = player_awards.dfcaverns_achievements or {}
|
||||
local source_list = achievement_parents[achievement_parent]
|
||||
local total = #source_list
|
||||
local count = 0
|
||||
for _, source_achievement in pairs(source_list) do
|
||||
if unlocked[source_achievement] == source_achievement then count = count + 1 end
|
||||
end
|
||||
local none_missing = true
|
||||
for _, achievement in pairs(target_list) do
|
||||
if unlocked[achievement] ~= achievement then
|
||||
none_missing = false
|
||||
break
|
||||
player_awards.dfcaverns_achievements[achievement_parent] = count
|
||||
minetest.debug(dump(player_awards))
|
||||
awards.save()
|
||||
if count >= total then
|
||||
minetest.after(4, awards.unlock, player_name, achievement_parent)
|
||||
end
|
||||
--end
|
||||
end
|
||||
if none_missing then
|
||||
minetest.after(4, function() awards.unlock(player_name, target_achievement) end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
dofile(modpath.."/travel.lua")
|
||||
dofile(modpath.."/farming.lua")
|
||||
|
@ -1,6 +1,6 @@
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local nethercap_name = df_dependencies.nethercap_name
|
||||
|
||||
local nethercap_name = df_dependencies.nethercap_name
|
||||
local lava_node = df_dependencies.node_name_lava_source
|
||||
|
||||
local node_types = {}
|
||||
@ -179,91 +179,96 @@ awards.register_achievement("dfcaverns_visit_tower_cap", {
|
||||
title = S("Discover Tower Caps"),
|
||||
description = S("Discover a cavern where Tower Caps grow in the wild."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_towercapx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_fungiwood", {
|
||||
title = S("Discover Fungiwood"),
|
||||
description = S("Discover a cavern where Fungiwoods grow in the wild."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_fungiwoodx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_goblin_cap", {
|
||||
title = S("Discover Goblin Caps"),
|
||||
description = S("Discover a cavern where Goblin Caps grow in the wild."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_goblincapx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_spore_tree", {
|
||||
title = S("Discover Spore Trees"),
|
||||
description = S("Discover a cavern where Spore Trees grow in the wild."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_sporetreesx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_tunnel_tube", {
|
||||
title = S("Discover Tunnel Tubes"),
|
||||
description = S("Discover a cavern where Tunnel Tubes grow in the wild."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_tunneltubex32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_nethercap", {
|
||||
title = S("Discover @1s", nethercap_name),
|
||||
description = S("Discover a cavern where @1s grow in the wild.", nethercap_name),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_nethercapx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_blood_thorn", {
|
||||
title = S("Discover Bloodthorns"),
|
||||
description = S("Discover a cavern where Bloodthorns grow in the wild."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_bloodthornx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_black_cap", {
|
||||
title = S("Discover Black Caps"),
|
||||
description = S("Discover a cavern where Black Caps grow in the wild."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_blackcapx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_sunless_sea", {
|
||||
title = S("Discover the Sunless Sea"),
|
||||
description = S("Discover the giant caverns to which all water from the surface ultimately drain."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_seax32.png^dfcaverns_awards_cavern_towercapx32.png^dfcaverns_awards_cavern_fungiwoodx32.png^dfcaverns_awards_cavern_goblincapx32.png^dfcaverns_awards_cavern_sporetreesx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_all_upper_biomes", {
|
||||
title = S("Discover All Fungal Cavern Types"),
|
||||
description = S("Discover examples of all of the fungal cavern biomes."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..df_dependencies.texture_mapping_kit.."^dfcaverns_awards_foregroundx32.png",
|
||||
})
|
||||
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_oil_sea", {
|
||||
title = S("Discover the Oil Sea"),
|
||||
description = S("Discover a cavern containing oil deep underground."),
|
||||
icon =cavern_background.."^dfcaverns_awards_cavern_oilx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_middle_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_lava_sea", {
|
||||
title = S("Discover the Magma Sea"),
|
||||
description = S("Discover the sea of magma that volcanoes draw from."),
|
||||
icon = cavern_background.."^dfcaverns_awards_cavern_lavax32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_middle_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_underworld", {
|
||||
title = S("Discover the Underworld"),
|
||||
description = S("Discover the ancient caverns at the foundations of the world."),
|
||||
icon ="dfcaverns_awards_cavern_underworldx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_middle_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_all_middle_biomes", {
|
||||
title = S("Discover All Overworld Cavern Types"),
|
||||
description = S("Discover all of the major types of cavern environments between the Sunless Sea and the foundations of the world."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..df_dependencies.texture_mapping_kit.."^dfcaverns_awards_foregroundx32.png",
|
||||
})
|
||||
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_primordial_jungle", {
|
||||
title = S("Discover the Primordial Jungle"),
|
||||
description = S("Discover the lost jungles below the foundations of the world."),
|
||||
icon = "dfcaverns_awards_cavern_backgroundx32.png^(dfcaverns_awards_cavern_background_stalactitex32.png^[multiply:#127a0b)^dfcaverns_awards_cavern_background_platformx32.png^dfcaverns_awards_cavern_junglex32.png^dfcaverns_awards_foregroundx32.png",
|
||||
secret = true,
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_primordial_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_primordial_fungal", {
|
||||
@ -271,13 +276,7 @@ awards.register_achievement("dfcaverns_visit_primordial_fungal", {
|
||||
description = S("Discover the fungus-ridden caverns below the foundations of the world."),
|
||||
icon = cavern_background .. "^dfcaverns_awards_cavern_fungalx32.png^dfcaverns_awards_cavern_primordial_mushx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
secret = true,
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_all_primordial_biomes", {
|
||||
title = S("Discover all Primordial Cavern Types"),
|
||||
description = S("Discover all of the major types of cavern below the foundations of the world."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..df_dependencies.texture_mapping_kit.."^dfcaverns_awards_foregroundx32.png",
|
||||
secret = true,
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_primordial_biomes", "dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
local stone_background = "([combine:32x32:0,0=" .. df_dependencies.texture_cobble .. ":0,16=" .. df_dependencies.texture_cobble
|
||||
@ -288,18 +287,61 @@ awards.register_achievement("dfcaverns_visit_chasm", {
|
||||
title = S("Discover a Deep Chasm"),
|
||||
description = S("Discover a gigantic underground natural chasm."),
|
||||
icon = stone_background .. "^dfcaverns_awards_cavern_chasmx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_pit", {
|
||||
title = S("Discover a Deep Sinkhole"),
|
||||
description = S("Discover a deep natural sinkhole."),
|
||||
icon = stone_background .. "^dfcaverns_awards_cavern_pitx32.png^dfcaverns_awards_foregroundx32.png",
|
||||
_dfcaverns_achievements = {"dfcaverns_visit_all_caverns"},
|
||||
})
|
||||
|
||||
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_all_upper_biomes", {
|
||||
title = S("Discover All Fungal Cavern Types"),
|
||||
description = S("Discover examples of all of the fungal cavern biomes."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..df_dependencies.texture_mapping_kit.."^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_visit_all_upper_biomes",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_visit_all_upper_biomes"),
|
||||
},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_all_middle_biomes", {
|
||||
title = S("Discover All Overworld Cavern Types"),
|
||||
description = S("Discover all of the major types of cavern environments between the Sunless Sea and the foundations of the world."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..df_dependencies.texture_mapping_kit.."^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_visit_all_middle_biomes",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_visit_all_middle_biomes"),
|
||||
},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_all_primordial_biomes", {
|
||||
title = S("Discover all Primordial Cavern Types"),
|
||||
description = S("Discover all of the major types of cavern below the foundations of the world."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..df_dependencies.texture_mapping_kit.."^dfcaverns_awards_foregroundx32.png",
|
||||
secret = true,
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_visit_all_primordial_biomes",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_visit_all_primordial_biomes"),
|
||||
},
|
||||
})
|
||||
|
||||
awards.register_achievement("dfcaverns_visit_all_caverns", {
|
||||
title = S("Discover All Underground Cavern Types"),
|
||||
description = S("Discover all major kinds of giant cavern environment."),
|
||||
icon = "dfcaverns_awards_backgroundx32.png^"..df_dependencies.texture_mapping_kit.."^dfcaverns_awards_foregroundx32.png",
|
||||
trigger = {
|
||||
type="dfcaverns_achievements",
|
||||
achievement_name="dfcaverns_visit_all_caverns",
|
||||
target=df_achievements.get_child_achievement_count("dfcaverns_visit_all_caverns"),
|
||||
},
|
||||
})
|
||||
|
||||
-- other places
|
||||
|
Loading…
Reference in New Issue
Block a user