Use awards for technical things, and achievements for user facing things

Fixes #18
This commit is contained in:
rubenwardy 2018-04-05 17:09:42 +01:00
parent e110bbbc7a
commit 4e6ade249e
6 changed files with 105 additions and 104 deletions

View File

@ -9,10 +9,10 @@ Majority of awards are back ported from Calinou's old fork in Carbone, under sam
# API # API
## Registering Achievements ## Registering Awards
```lua ```lua
awards.register_achievement("mymod:myaward", { awards.register_award("mymod:myaward", {
description = "The title of the award", description = "The title of the award",
-- Optional: -- Optional:

View File

@ -286,7 +286,7 @@ function awards.register_on_unlock(func)
table.insert(awards.on_unlock, func) table.insert(awards.on_unlock, func)
end end
function awards.register_achievement(name, def) function awards.register_award(name, def)
def.name = name def.name = name
-- Add Triggers -- Add Triggers
@ -337,7 +337,7 @@ function awards.clear_player(name)
end end
-- This function is called whenever a target condition is met. -- This function is called whenever a target condition is met.
-- It checks if a player already has that achievement, and if they do not, -- It checks if a player already has that award, and if they do not,
-- it gives it to them -- it gives it to them
---------------------------------------------- ----------------------------------------------
--awards.unlock(name, award) --awards.unlock(name, award)
@ -411,7 +411,7 @@ function awards.unlock(name, award)
if awards.show_mode == "chat" then if awards.show_mode == "chat" then
local chat_announce local chat_announce
if awdef.secret == true then if awdef.secret then
chat_announce = S("Secret Achievement Unlocked: %s") chat_announce = S("Secret Achievement Unlocked: %s")
else else
chat_announce = S("Achievement Unlocked: %s") chat_announce = S("Achievement Unlocked: %s")
@ -433,7 +433,7 @@ function awards.unlock(name, award)
alignment = {x = 0, y = -1} alignment = {x = 0, y = -1}
}) })
local hud_announce local hud_announce
if awdef.secret == true then if awdef.secret then
hud_announce = S("Secret Achievement Unlocked!") hud_announce = S("Secret Achievement Unlocked!")
else else
hud_announce = S("Achievement Unlocked!") hud_announce = S("Achievement Unlocked!")

View File

@ -4,7 +4,7 @@ local S = awards.gettext
-- Saint-Maclou -- Saint-Maclou
if minetest.get_modpath("moreblocks") then if minetest.get_modpath("moreblocks") then
awards.register_achievement("award_saint_maclou",{ awards.register_award("award_saint_maclou",{
title = S("Saint-Maclou"), title = S("Saint-Maclou"),
description = S("Place 20 coal checkers."), description = S("Place 20 coal checkers."),
icon = "awards_novicebuilder.png", icon = "awards_novicebuilder.png",
@ -16,7 +16,7 @@ if minetest.get_modpath("moreblocks") then
}) })
-- Castorama -- Castorama
awards.register_achievement("award_castorama",{ awards.register_award("award_castorama",{
title = S("Castorama"), title = S("Castorama"),
description = S("Place 20 iron checkers."), description = S("Place 20 iron checkers."),
icon = "awards_novicebuilder.png", icon = "awards_novicebuilder.png",
@ -28,7 +28,7 @@ if minetest.get_modpath("moreblocks") then
}) })
-- Sam the Trapper -- Sam the Trapper
awards.register_achievement("award_sam_the_trapper",{ awards.register_award("award_sam_the_trapper",{
title = S("Sam the Trapper"), title = S("Sam the Trapper"),
description = S("Place 2 trap stones."), description = S("Place 2 trap stones."),
icon = "awards_novicebuilder.png", icon = "awards_novicebuilder.png",
@ -43,7 +43,7 @@ end
-- This award can't be part of Unified Inventory, it would make a circular dependency -- This award can't be part of Unified Inventory, it would make a circular dependency
if minetest.get_modpath("unified_inventory") then if minetest.get_modpath("unified_inventory") then
if minetest.get_all_craft_recipes("unified_inventory:bag_large") ~= nil then if minetest.get_all_craft_recipes("unified_inventory:bag_large") ~= nil then
awards.register_achievement("awards_ui_bags", { awards.register_award("awards_ui_bags", {
title = S("Backpacker"), title = S("Backpacker"),
description = S("Craft 4 large bags."), description = S("Craft 4 large bags."),
icon = "awards_ui_bags.png", icon = "awards_ui_bags.png",
@ -57,7 +57,7 @@ if minetest.get_modpath("unified_inventory") then
end end
if minetest.get_modpath("fire") then if minetest.get_modpath("fire") then
awards.register_achievement("awards_pyro", { awards.register_award("awards_pyro", {
title = S("Pyromaniac"), title = S("Pyromaniac"),
description = S("Craft 8 times flint and steel."), description = S("Craft 8 times flint and steel."),
icon = "fire_flint_steel.png", icon = "fire_flint_steel.png",
@ -68,7 +68,7 @@ if minetest.get_modpath("fire") then
} }
}) })
if minetest.settings:get_bool("disable_fire") ~= true then if minetest.settings:get_bool("disable_fire") ~= true then
awards.register_achievement("awards_firefighter", { awards.register_award("awards_firefighter", {
title = S("Firefighter"), title = S("Firefighter"),
description = S("Put out 1000 fires."), description = S("Put out 1000 fires."),
icon = "awards_firefighter.png", icon = "awards_firefighter.png",
@ -83,7 +83,7 @@ end
if minetest.get_modpath("default") then if minetest.get_modpath("default") then
-- Light it up -- Light it up
awards.register_achievement("award_lightitup",{ awards.register_award("award_lightitup",{
title = S("Light It Up"), title = S("Light It Up"),
description = S("Place 100 torches."), description = S("Place 100 torches."),
icon = "awards_novicebuilder.png^awards_level1.png", icon = "awards_novicebuilder.png^awards_level1.png",
@ -95,7 +95,7 @@ if minetest.get_modpath("default") then
}) })
-- Light ALL the things! -- Light ALL the things!
awards.register_achievement("award_well_lit",{ awards.register_award("award_well_lit",{
title = S("Well Lit"), title = S("Well Lit"),
description = S("Place 1,000 torches."), description = S("Place 1,000 torches."),
icon = "awards_novicebuilder.png^awards_level2.png", icon = "awards_novicebuilder.png^awards_level2.png",
@ -106,7 +106,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_meselamp",{ awards.register_award("award_meselamp",{
title = S("Really Well Lit"), title = S("Really Well Lit"),
description = S("Craft 10 mese lamps."), description = S("Craft 10 mese lamps."),
icon = "default_meselamp.png", icon = "default_meselamp.png",
@ -117,7 +117,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_stonebrick", { awards.register_award("awards_stonebrick", {
title = S("Outpost"), title = S("Outpost"),
description = S("Craft 200 stone bricks."), description = S("Craft 200 stone bricks."),
icon = "default_stone_brick.png^awards_level1.png", icon = "default_stone_brick.png^awards_level1.png",
@ -128,7 +128,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_stonebrick2", { awards.register_award("awards_stonebrick2", {
title = S("Watchtower"), title = S("Watchtower"),
description = S("Craft 800 stone bricks."), description = S("Craft 800 stone bricks."),
icon = "default_stone_brick.png^awards_level2.png", icon = "default_stone_brick.png^awards_level2.png",
@ -139,7 +139,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_stonebrick3", { awards.register_award("awards_stonebrick3", {
title = S("Fortress"), title = S("Fortress"),
description = S("Craft 3,200 stone bricks."), description = S("Craft 3,200 stone bricks."),
icon = "default_stone_brick.png^awards_level3.png", icon = "default_stone_brick.png^awards_level3.png",
@ -150,7 +150,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_desert_stonebrick", { awards.register_award("awards_desert_stonebrick", {
title = S("Desert Dweller"), title = S("Desert Dweller"),
description = S("Craft 400 desert stone bricks."), description = S("Craft 400 desert stone bricks."),
icon = "default_desert_stone_brick.png", icon = "default_desert_stone_brick.png",
@ -161,7 +161,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_desertstonebrick", { awards.register_award("awards_desertstonebrick", {
title = S("Pharaoh"), title = S("Pharaoh"),
description = S("Craft 100 sandstone bricks."), description = S("Craft 100 sandstone bricks."),
icon = "default_sandstone_brick.png", icon = "default_sandstone_brick.png",
@ -172,7 +172,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_bookshelf", { awards.register_award("awards_bookshelf", {
title = S("Little Library"), title = S("Little Library"),
description = S("Craft 7 bookshelves."), description = S("Craft 7 bookshelves."),
icon = "default_bookshelf.png", icon = "default_bookshelf.png",
@ -183,7 +183,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_obsidian", { awards.register_award("awards_obsidian", {
title = S("Lava and Water"), title = S("Lava and Water"),
description = S("Mine your first obsidian."), description = S("Mine your first obsidian."),
icon = "default_obsidian.png^awards_level1.png", icon = "default_obsidian.png^awards_level1.png",
@ -196,7 +196,7 @@ if minetest.get_modpath("default") then
}) })
-- Obsessed with Obsidian -- Obsessed with Obsidian
awards.register_achievement("award_obsessed_with_obsidian",{ awards.register_award("award_obsessed_with_obsidian",{
title = S("Obsessed with Obsidian"), title = S("Obsessed with Obsidian"),
description = S("Mine 50 obsidian."), description = S("Mine 50 obsidian."),
icon = "default_obsidian.png^awards_level2.png", icon = "default_obsidian.png^awards_level2.png",
@ -209,7 +209,7 @@ if minetest.get_modpath("default") then
}) })
-- Proof that player has found lava -- Proof that player has found lava
awards.register_achievement("award_lavaminer",{ awards.register_award("award_lavaminer",{
title = S("Lava Miner"), title = S("Lava Miner"),
description = S("Mine any block while being very close to lava."), description = S("Mine any block while being very close to lava."),
background = "awards_bg_mining.png", background = "awards_bg_mining.png",
@ -225,7 +225,7 @@ if minetest.get_modpath("default") then
end) end)
-- On the way -- On the way
awards.register_achievement("award_on_the_way", { awards.register_award("award_on_the_way", {
title = S("On The Way"), title = S("On The Way"),
description = S("Place 100 rails."), description = S("Place 100 rails."),
icon = "carts_rail_straight.png", icon = "carts_rail_straight.png",
@ -236,7 +236,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_lumberjack_firstday", { awards.register_award("award_lumberjack_firstday", {
title = S("First Day in the Woods"), title = S("First Day in the Woods"),
description = S("Dig 6 tree blocks."), description = S("Dig 6 tree blocks."),
icon = "default_tree.png^awards_level1.png", icon = "default_tree.png^awards_level1.png",
@ -248,7 +248,7 @@ if minetest.get_modpath("default") then
}) })
-- Lumberjack -- Lumberjack
awards.register_achievement("award_lumberjack", { awards.register_award("award_lumberjack", {
title = S("Lumberjack"), title = S("Lumberjack"),
description = S("Dig 36 tree blocks."), description = S("Dig 36 tree blocks."),
icon = "default_tree.png^awards_level2.png", icon = "default_tree.png^awards_level2.png",
@ -260,7 +260,7 @@ if minetest.get_modpath("default") then
}) })
-- Semi-pro Lumberjack -- Semi-pro Lumberjack
awards.register_achievement("award_lumberjack_semipro", { awards.register_award("award_lumberjack_semipro", {
title = S("Semi-pro Lumberjack"), title = S("Semi-pro Lumberjack"),
description = S("Dig 216 tree blocks."), description = S("Dig 216 tree blocks."),
icon = "default_tree.png^awards_level3.png", icon = "default_tree.png^awards_level3.png",
@ -272,7 +272,7 @@ if minetest.get_modpath("default") then
}) })
-- Professional Lumberjack -- Professional Lumberjack
awards.register_achievement("award_lumberjack_professional", { awards.register_award("award_lumberjack_professional", {
title = S("Professional Lumberjack"), title = S("Professional Lumberjack"),
description = S("Dig 1,296 tree blocks."), description = S("Dig 1,296 tree blocks."),
icon = "default_tree.png^awards_level4.png", icon = "default_tree.png^awards_level4.png",
@ -284,7 +284,7 @@ if minetest.get_modpath("default") then
}) })
-- Junglebaby -- Junglebaby
awards.register_achievement("award_junglebaby", { awards.register_award("award_junglebaby", {
title = S("Junglebaby"), title = S("Junglebaby"),
description = S("Dig 100 jungle tree blocks."), description = S("Dig 100 jungle tree blocks."),
icon = "default_jungletree.png^awards_level1.png", icon = "default_jungletree.png^awards_level1.png",
@ -296,7 +296,7 @@ if minetest.get_modpath("default") then
}) })
-- Jungleman -- Jungleman
awards.register_achievement("award_jungleman", { awards.register_award("award_jungleman", {
title = S("Jungleman"), title = S("Jungleman"),
description = S("Dig 1,000 jungle tree blocks."), description = S("Dig 1,000 jungle tree blocks."),
icon = "default_jungletree.png^awards_level2.png", icon = "default_jungletree.png^awards_level2.png",
@ -308,7 +308,7 @@ if minetest.get_modpath("default") then
}) })
-- Found some Mese! -- Found some Mese!
awards.register_achievement("award_mesefind", { awards.register_award("award_mesefind", {
title = S("First Mese Find"), title = S("First Mese Find"),
description = S("Mine your first mese ore."), description = S("Mine your first mese ore."),
icon = "default_stone.png^default_mineral_mese.png", icon = "default_stone.png^default_mineral_mese.png",
@ -321,7 +321,7 @@ if minetest.get_modpath("default") then
}) })
-- Mese Block -- Mese Block
awards.register_achievement("award_meseblock", { awards.register_award("award_meseblock", {
secret = true, secret = true,
title = S("Mese Mastery"), title = S("Mese Mastery"),
description = S("Mine a mese block."), description = S("Mine a mese block."),
@ -335,7 +335,7 @@ if minetest.get_modpath("default") then
}) })
-- You're a copper -- You're a copper
awards.register_achievement("award_youre_a_copper", { awards.register_award("award_youre_a_copper", {
title = S("Youre a copper"), title = S("Youre a copper"),
description = S("Dig 1,000 copper ores."), description = S("Dig 1,000 copper ores."),
icon = "default_stone.png^default_mineral_copper.png", icon = "default_stone.png^default_mineral_copper.png",
@ -348,7 +348,7 @@ if minetest.get_modpath("default") then
}) })
-- Mini Miner -- Mini Miner
awards.register_achievement("award_mine2", { awards.register_award("award_mine2", {
title = S("Mini Miner"), title = S("Mini Miner"),
description = S("Dig 100 stone blocks."), description = S("Dig 100 stone blocks."),
icon = "awards_miniminer.png^awards_level1.png", icon = "awards_miniminer.png^awards_level1.png",
@ -361,7 +361,7 @@ if minetest.get_modpath("default") then
}) })
-- Hardened Miner -- Hardened Miner
awards.register_achievement("award_mine3", { awards.register_award("award_mine3", {
title = S("Hardened Miner"), title = S("Hardened Miner"),
description = S("Dig 1,000 stone blocks."), description = S("Dig 1,000 stone blocks."),
icon = "awards_miniminer.png^awards_level2.png", icon = "awards_miniminer.png^awards_level2.png",
@ -374,7 +374,7 @@ if minetest.get_modpath("default") then
}) })
-- Master Miner -- Master Miner
awards.register_achievement("award_mine4", { awards.register_award("award_mine4", {
title = S("Master Miner"), title = S("Master Miner"),
description = S("Dig 10,000 stone blocks."), description = S("Dig 10,000 stone blocks."),
icon = "awards_miniminer.png^awards_level3.png", icon = "awards_miniminer.png^awards_level3.png",
@ -387,7 +387,7 @@ if minetest.get_modpath("default") then
}) })
-- Marchand de sable -- Marchand de sable
awards.register_achievement("award_marchand_de_sable", { awards.register_award("award_marchand_de_sable", {
title = S("Marchand De Sable"), title = S("Marchand De Sable"),
description = S("Dig 1,000 sand."), description = S("Dig 1,000 sand."),
icon = "default_sand.png", icon = "default_sand.png",
@ -399,7 +399,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_crafter_of_sticks", { awards.register_award("awards_crafter_of_sticks", {
title = S("Crafter of Sticks"), title = S("Crafter of Sticks"),
description = S("Craft 100 sticks."), description = S("Craft 100 sticks."),
icon = "default_stick.png", icon = "default_stick.png",
@ -410,7 +410,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_junglegrass", { awards.register_award("awards_junglegrass", {
title = S("Jungle Discoverer"), title = S("Jungle Discoverer"),
description = S("Mine your first jungle grass."), description = S("Mine your first jungle grass."),
icon = "default_junglegrass.png", icon = "default_junglegrass.png",
@ -421,7 +421,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_grass", { awards.register_award("awards_grass", {
title = S("Grasslands Discoverer"), title = S("Grasslands Discoverer"),
description = S("Mine some grass."), description = S("Mine some grass."),
icon = "default_grass_3.png", icon = "default_grass_3.png",
@ -432,7 +432,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_dry_grass", { awards.register_award("awards_dry_grass", {
title = S("Savannah Discoverer"), title = S("Savannah Discoverer"),
description = S("Mine some dry grass."), description = S("Mine some dry grass."),
icon = "default_dry_grass_3.png", icon = "default_dry_grass_3.png",
@ -443,7 +443,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_cactus", { awards.register_award("awards_cactus", {
title = S("Desert Discoverer"), title = S("Desert Discoverer"),
description = S("Mine your first cactus."), description = S("Mine your first cactus."),
icon = "default_cactus_side.png", icon = "default_cactus_side.png",
@ -454,7 +454,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_dry_shrub", { awards.register_award("awards_dry_shrub", {
title = S("Far Lands"), title = S("Far Lands"),
description = S("Mine your first dry shrub."), description = S("Mine your first dry shrub."),
icon = "default_dry_shrub.png", icon = "default_dry_shrub.png",
@ -465,7 +465,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_ice", { awards.register_award("awards_ice", {
title = S("Glacier Discoverer"), title = S("Glacier Discoverer"),
description = S("Mine your first ice."), description = S("Mine your first ice."),
icon = "default_ice.png", icon = "default_ice.png",
@ -477,7 +477,7 @@ if minetest.get_modpath("default") then
}) })
-- Proof that player visited snowy lands -- Proof that player visited snowy lands
awards.register_achievement("awards_snowblock", { awards.register_award("awards_snowblock", {
title = S("Very Simple Snow Man"), title = S("Very Simple Snow Man"),
description = S("Place two snow blocks."), description = S("Place two snow blocks."),
icon = "default_snow.png", icon = "default_snow.png",
@ -488,7 +488,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_gold_ore", { awards.register_award("awards_gold_ore", {
title = S("First Gold Find"), title = S("First Gold Find"),
description = S("Mine your first gold ore."), description = S("Mine your first gold ore."),
icon = "default_stone.png^default_mineral_gold.png^awards_level1.png", icon = "default_stone.png^default_mineral_gold.png^awards_level1.png",
@ -500,7 +500,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_gold_rush", { awards.register_award("awards_gold_rush", {
title = S("Gold Rush"), title = S("Gold Rush"),
description = S("Mine 45 gold ores."), description = S("Mine 45 gold ores."),
icon = "default_stone.png^default_mineral_gold.png^awards_level2.png", icon = "default_stone.png^default_mineral_gold.png^awards_level2.png",
@ -512,7 +512,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_diamond_ore", { awards.register_award("awards_diamond_ore", {
title = S("Wow, I am Diamonds!"), title = S("Wow, I am Diamonds!"),
description = S("Mine your first diamond ore."), description = S("Mine your first diamond ore."),
icon = "default_stone.png^default_mineral_diamond.png^awards_level1.png", icon = "default_stone.png^default_mineral_diamond.png^awards_level1.png",
@ -523,7 +523,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_diamond_rush", { awards.register_award("awards_diamond_rush", {
title = S("Girl's Best Friend"), title = S("Girl's Best Friend"),
description = S("Mine 18 diamond ores."), description = S("Mine 18 diamond ores."),
icon = "default_stone.png^default_mineral_diamond.png^awards_level2.png", icon = "default_stone.png^default_mineral_diamond.png^awards_level2.png",
@ -535,7 +535,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_diamondblock", { awards.register_award("awards_diamondblock", {
title = S("Hardest Block on Earth"), title = S("Hardest Block on Earth"),
description = S("Craft a diamond block."), description = S("Craft a diamond block."),
icon = "default_diamond_block.png", icon = "default_diamond_block.png",
@ -546,7 +546,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("awards_mossycobble", { awards.register_award("awards_mossycobble", {
title = S("In the Dungeon"), title = S("In the Dungeon"),
description = S("Mine a mossy cobblestone."), description = S("Mine a mossy cobblestone."),
icon = "default_mossycobble.png", icon = "default_mossycobble.png",
@ -557,7 +557,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_furnace", { awards.register_award("award_furnace", {
title = S("Smelter"), title = S("Smelter"),
description = S("Craft 10 furnaces."), description = S("Craft 10 furnaces."),
icon = "default_furnace_front.png", icon = "default_furnace_front.png",
@ -568,7 +568,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_chest", { awards.register_award("award_chest", {
title = S("Treasurer"), title = S("Treasurer"),
description = S("Craft 15 chests."), description = S("Craft 15 chests."),
icon = "default_chest_front.png", icon = "default_chest_front.png",
@ -579,7 +579,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_chest2", { awards.register_award("award_chest2", {
title = S("Bankier"), title = S("Bankier"),
description = S("Craft 30 locked chests."), description = S("Craft 30 locked chests."),
icon = "default_chest_lock.png", icon = "default_chest_lock.png",
@ -590,7 +590,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_brick", { awards.register_award("award_brick", {
title = S("Bricker"), title = S("Bricker"),
description = S("Craft 200 brick blocks."), description = S("Craft 200 brick blocks."),
icon = "default_brick.png", icon = "default_brick.png",
@ -601,7 +601,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_obsidianbrick", { awards.register_award("award_obsidianbrick", {
title = S("House of Obsidian"), title = S("House of Obsidian"),
description = S("Craft 100 obsidian bricks."), description = S("Craft 100 obsidian bricks."),
icon = "default_obsidian_brick.png", icon = "default_obsidian_brick.png",
@ -612,7 +612,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_placestone", { awards.register_award("award_placestone", {
title = S("Build a Cave"), title = S("Build a Cave"),
description = S("Place 100 stone."), description = S("Place 100 stone."),
icon = "default_stone.png", icon = "default_stone.png",
@ -623,7 +623,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_woodladder", { awards.register_award("award_woodladder", {
title = S("Long Ladder"), title = S("Long Ladder"),
description = S("Place 400 wooden ladders."), description = S("Place 400 wooden ladders."),
icon = "default_ladder_wood.png", icon = "default_ladder_wood.png",
@ -634,7 +634,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_steelladder", { awards.register_award("award_steelladder", {
title = S("Industrial Age"), title = S("Industrial Age"),
description = S("Place 40 steel ladders."), description = S("Place 40 steel ladders."),
icon = "default_ladder_steel.png", icon = "default_ladder_steel.png",
@ -645,7 +645,7 @@ if minetest.get_modpath("default") then
} }
}) })
awards.register_achievement("award_apples", { awards.register_award("award_apples", {
title = S("Yummy!"), title = S("Yummy!"),
description = S("Eat 80 apples."), description = S("Eat 80 apples."),
icon = "default_apple.png", icon = "default_apple.png",
@ -658,7 +658,7 @@ if minetest.get_modpath("default") then
end end
if minetest.get_modpath("vessels") then if minetest.get_modpath("vessels") then
awards.register_achievement("award_vessels_shelf", { awards.register_award("award_vessels_shelf", {
title = S("Glasser"), title = S("Glasser"),
icon = "vessels_shelf.png", icon = "vessels_shelf.png",
description = S("Craft 14 vessels shelves."), description = S("Craft 14 vessels shelves."),
@ -671,7 +671,7 @@ if minetest.get_modpath("vessels") then
end end
if minetest.get_modpath("farming") then if minetest.get_modpath("farming") then
awards.register_achievement("awards_farmer", { awards.register_award("awards_farmer", {
title = S("Farming Skills Acquired"), title = S("Farming Skills Acquired"),
description = S("Harvest a fully grown wheat plant."), description = S("Harvest a fully grown wheat plant."),
icon = "farming_wheat_8.png^awards_level1.png", icon = "farming_wheat_8.png^awards_level1.png",
@ -681,7 +681,7 @@ if minetest.get_modpath("farming") then
target = 1 target = 1
} }
}) })
awards.register_achievement("awards_farmer2", { awards.register_award("awards_farmer2", {
title = S("Field Worker"), title = S("Field Worker"),
description = S("Harvest 25 fully grown wheat plants."), description = S("Harvest 25 fully grown wheat plants."),
icon = "farming_wheat_8.png^awards_level2.png", icon = "farming_wheat_8.png^awards_level2.png",
@ -692,7 +692,7 @@ if minetest.get_modpath("farming") then
} }
}) })
awards.register_achievement("awards_farmer3", { awards.register_award("awards_farmer3", {
title = S("Aspiring Farmer"), title = S("Aspiring Farmer"),
description = S("Harvest 125 fully grown wheat plants."), description = S("Harvest 125 fully grown wheat plants."),
icon = "farming_wheat_8.png^awards_level3.png", icon = "farming_wheat_8.png^awards_level3.png",
@ -703,7 +703,7 @@ if minetest.get_modpath("farming") then
} }
}) })
awards.register_achievement("awards_farmer4", { awards.register_award("awards_farmer4", {
title = S("Wheat Magnate"), title = S("Wheat Magnate"),
description = S("Harvest 625 fully grown wheat plants."), description = S("Harvest 625 fully grown wheat plants."),
icon = "farming_wheat_8.png^awards_level4.png", icon = "farming_wheat_8.png^awards_level4.png",
@ -714,7 +714,7 @@ if minetest.get_modpath("farming") then
} }
}) })
awards.register_achievement("award_bread", { awards.register_award("award_bread", {
title = S("Baker"), title = S("Baker"),
description = S("Eat 10 loaves of bread."), description = S("Eat 10 loaves of bread."),
icon = "farming_bread.png", icon = "farming_bread.png",
@ -728,7 +728,7 @@ if minetest.get_modpath("farming") then
end end
if minetest.get_modpath("wool") and minetest.get_modpath("farming") then if minetest.get_modpath("wool") and minetest.get_modpath("farming") then
awards.register_achievement("awards_wool", { awards.register_award("awards_wool", {
title = S("Wool Over Your Eyes"), title = S("Wool Over Your Eyes"),
description = S("Craft 250 white wool."), description = S("Craft 250 white wool."),
icon = "wool_white.png", icon = "wool_white.png",
@ -741,7 +741,7 @@ if minetest.get_modpath("wool") and minetest.get_modpath("farming") then
end end
if minetest.get_modpath("beds") then if minetest.get_modpath("beds") then
awards.register_achievement("award_bed", { awards.register_award("award_bed", {
title = S("Hotelier"), title = S("Hotelier"),
description = S("Craft 15 fancy beds."), description = S("Craft 15 fancy beds."),
icon = "beds_bed_fancy.png", icon = "beds_bed_fancy.png",
@ -754,7 +754,7 @@ if minetest.get_modpath("beds") then
end end
if minetest.get_modpath("stairs") then if minetest.get_modpath("stairs") then
awards.register_achievement("award_stairs_goldblock", { awards.register_award("award_stairs_goldblock", {
title = S("Filthy Rich"), title = S("Filthy Rich"),
description = S("Craft 24 gold block stairs."), description = S("Craft 24 gold block stairs."),
icon = "default_gold_block.png", icon = "default_gold_block.png",
@ -767,7 +767,7 @@ if minetest.get_modpath("stairs") then
end end
if minetest.get_modpath("dye") then if minetest.get_modpath("dye") then
awards.register_achievement("awards_dye_red", { awards.register_award("awards_dye_red", {
title = S("Roses Are Red"), title = S("Roses Are Red"),
description = S("Craft 400 red dyes."), description = S("Craft 400 red dyes."),
icon = "dye_red.png", icon = "dye_red.png",
@ -778,7 +778,7 @@ if minetest.get_modpath("dye") then
} }
}) })
awards.register_achievement("awards_dye_yellow", { awards.register_award("awards_dye_yellow", {
title = S("Dandelions are Yellow"), title = S("Dandelions are Yellow"),
description = S("Craft 400 yellow dyes."), description = S("Craft 400 yellow dyes."),
icon = "dye_yellow.png", icon = "dye_yellow.png",
@ -789,7 +789,7 @@ if minetest.get_modpath("dye") then
} }
}) })
awards.register_achievement("awards_dye_blue", { awards.register_award("awards_dye_blue", {
title = S("Geraniums are Blue"), title = S("Geraniums are Blue"),
description = S("Craft 400 blue dyes."), description = S("Craft 400 blue dyes."),
icon = "dye_blue.png", icon = "dye_blue.png",
@ -800,7 +800,7 @@ if minetest.get_modpath("dye") then
} }
}) })
awards.register_achievement("awards_dye_white", { awards.register_award("awards_dye_white", {
title = S("White Color Stock"), title = S("White Color Stock"),
description = S("Craft 100 white dyes."), description = S("Craft 100 white dyes."),
icon = "dye_white.png", icon = "dye_white.png",
@ -813,7 +813,7 @@ if minetest.get_modpath("dye") then
end end
if minetest.get_modpath("flowers") then if minetest.get_modpath("flowers") then
awards.register_achievement("awards_brown_mushroom1", { awards.register_award("awards_brown_mushroom1", {
title = S("Tasty Mushrooms"), title = S("Tasty Mushrooms"),
description = S("Eat 3 brown mushrooms."), description = S("Eat 3 brown mushrooms."),
icon = "flowers_mushroom_brown.png^awards_level1.png", icon = "flowers_mushroom_brown.png^awards_level1.png",
@ -823,7 +823,7 @@ if minetest.get_modpath("flowers") then
target = 3, target = 3,
} }
}) })
awards.register_achievement("awards_brown_mushroom2", { awards.register_award("awards_brown_mushroom2", {
title = S("Mushroom Lover"), title = S("Mushroom Lover"),
description = S("Eat 33 brown mushrooms."), description = S("Eat 33 brown mushrooms."),
icon = "flowers_mushroom_brown.png^awards_level2.png", icon = "flowers_mushroom_brown.png^awards_level2.png",
@ -833,7 +833,7 @@ if minetest.get_modpath("flowers") then
target = 33, target = 33,
} }
}) })
awards.register_achievement("awards_brown_mushroom3", { awards.register_award("awards_brown_mushroom3", {
title = S("Underground Mushroom Farmer"), title = S("Underground Mushroom Farmer"),
description = S("Eat 333 brown mushrooms."), description = S("Eat 333 brown mushrooms."),
icon = "flowers_mushroom_brown.png^awards_level3.png", icon = "flowers_mushroom_brown.png^awards_level3.png",
@ -861,7 +861,7 @@ minetest.after(0, function()
return return
end end
awards.register_achievement("awards_builder1", { awards.register_award("awards_builder1", {
title = S("Builder"), title = S("Builder"),
icon = "awards_house.png^awards_level1.png", icon = "awards_house.png^awards_level1.png",
trigger = { trigger = {
@ -869,7 +869,7 @@ minetest.after(0, function()
target = 1000, target = 1000,
}, },
}) })
awards.register_achievement("awards_builder2", { awards.register_award("awards_builder2", {
title = S("Constructor"), title = S("Constructor"),
icon = "awards_house.png^awards_level2.png", icon = "awards_house.png^awards_level2.png",
trigger = { trigger = {
@ -877,7 +877,7 @@ minetest.after(0, function()
target = 5000, target = 5000,
}, },
}) })
awards.register_achievement("awards_builder3", { awards.register_award("awards_builder3", {
title = S("Architect"), title = S("Architect"),
icon = "awards_house.png^awards_level3.png", icon = "awards_house.png^awards_level3.png",
trigger = { trigger = {
@ -885,7 +885,7 @@ minetest.after(0, function()
target = 10000, target = 10000,
}, },
}) })
awards.register_achievement("awards_builder4", { awards.register_award("awards_builder4", {
title = S("Master Architect"), title = S("Master Architect"),
icon = "awards_house.png^awards_level4.png", icon = "awards_house.png^awards_level4.png",
trigger = { trigger = {
@ -897,7 +897,7 @@ end)
if minetest.get_modpath("nyancat") then if minetest.get_modpath("nyancat") then
-- Found a Nyan cat! -- Found a Nyan cat!
awards.register_achievement("award_nyanfind", { awards.register_award("award_nyanfind", {
secret = true, secret = true,
title = S("A Cat in a Pop-Tart?!"), title = S("A Cat in a Pop-Tart?!"),
description = S("Mine a nyan cat."), description = S("Mine a nyan cat."),

20
gui.lua
View File

@ -67,7 +67,7 @@ function awards.get_formspec(name, to, sid)
local data = awards.player(name) local data = awards.player(name)
if #awards_list == 0 then if #awards_list == 0 then
formspec = formspec .. "label[3.9,1.5;"..minetest.formspec_escape(S("Error: No awards available.")).."]" formspec = formspec .. "label[3.9,1.5;"..minetest.formspec_escape(S("Error: No achivements available.")).."]"
formspec = formspec .. "button_exit[4.2,2.3;3,1;close;"..minetest.formspec_escape(S("OK")).."]" formspec = formspec .. "button_exit[4.2,2.3;3,1;close;"..minetest.formspec_escape(S("OK")).."]"
return formspec return formspec
end end
@ -79,12 +79,12 @@ function awards.get_formspec(name, to, sid)
if def and def.secret and not item.unlocked then if def and def.secret and not item.unlocked then
formspec = formspec .. "label[1,2.75;".. formspec = formspec .. "label[1,2.75;"..
minetest.formspec_escape(S("(Secret Award)")).."]".. minetest.formspec_escape(S("(Secret Achievement)")).."]"..
"image[1,0;3,3;awards_unknown.png]" "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;;".. formspec = formspec .. "textarea[0.25,3.25;4.8,1.7;;"..
minetest.formspec_escape( minetest.formspec_escape(
S("Unlock this award to find out what it is."))..";]" S("Unlock this achievement to find out what it is."))..";]"
end end
else else
local title = item.name local title = item.name
@ -139,7 +139,7 @@ function awards.get_formspec(name, to, sid)
first = false first = false
if def.secret and not award.unlocked then if def.secret and not award.unlocked then
formspec = formspec .. "#707070"..minetest.formspec_escape(S("(Secret Award)")) formspec = formspec .. "#707070"..minetest.formspec_escape(S("(Secret Achievement)"))
else else
local title = award.name local title = award.name
if def and def.title then if def and def.title then
@ -166,19 +166,19 @@ function awards.show_to(name, to, sid, text)
end end
local data = awards.player(to) local data = awards.player(to)
if name == to and data.disabled then if name == to and data.disabled then
minetest.chat_send_player(S("You've disabled awards. Type /awards enable to reenable.")) minetest.chat_send_player(S("You've disabled achievement. Type /awards enable to reenable."))
return return
end end
if text then if text then
local awards_list = order_awards(name) local awards_list = order_awards(name)
if #awards_list == 0 then if #awards_list == 0 then
minetest.chat_send_player(to, S("Error: No awards available.")) minetest.chat_send_player(to, S("Error: No achievement available."))
return return
elseif not data or not data.unlocked then elseif not data or not data.unlocked then
minetest.chat_send_player(to, S("You have not unlocked any awards.")) minetest.chat_send_player(to, S("You have not unlocked any achievements."))
return return
end end
minetest.chat_send_player(to, string.format(S("%ss awards:"), name)) minetest.chat_send_player(to, string.format(S("%ss achievements:"), name))
for str, _ in pairs(data.unlocked) do for str, _ in pairs(data.unlocked) do
local def = awards.registered_awards[str] local def = awards.registered_awards[str]
@ -211,7 +211,7 @@ end
if minetest.get_modpath("sfinv") then if minetest.get_modpath("sfinv") then
sfinv.register_page("awards:awards", { sfinv.register_page("awards:awards", {
title = S("Awards"), title = S("Achievements"),
on_enter = function(self, player, context) on_enter = function(self, player, context)
context.awards_idx = 1 context.awards_idx = 1
end, end,
@ -237,7 +237,7 @@ if minetest.get_modpath("unified_inventory") ~= nil then
unified_inventory.register_button("awards", { unified_inventory.register_button("awards", {
type = "image", type = "image",
image = "awards_ui_icon.png", image = "awards_ui_icon.png",
tooltip = S("Awards"), tooltip = S("Achievements"),
action = function(player) action = function(player)
local name = player:get_player_name() local name = player:get_player_name()
awards.show_to(name, name, nil, false) awards.show_to(name, name, nil, false)

View File

@ -27,3 +27,4 @@ awards.register_onChat = awards.register_on_chat
awards.register_onJoin = awards.register_on_join awards.register_onJoin = awards.register_on_join
awards.register_onCraft = awards.register_on_craft awards.register_onCraft = awards.register_on_craft
awards.def = awards.registered_awards awards.def = awards.registered_awards
awards.register_achievement = awards.register_award

View File

@ -1,7 +1,7 @@
name = awards name = awards
title = Achievements title = Awards
author = rubenwardy author = rubenwardy
description = Adds achievements to Minetest, and an API to register new ones. description = Adds awards 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,nyancat 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