Achievements: Delicious Fish, Acquire Hardware

This commit is contained in:
Wuzzy 2017-03-05 23:58:26 +01:00
parent cf1be05710
commit 419169d06b
3 changed files with 27 additions and 10 deletions

@ -57,16 +57,6 @@ awards.register_achievement("mcl:makeBread", {
target = 1
}
})
awards.register_achievement("mcl:cookFish", {
title = S("Delicious Fish"),
description = S("Catch a fish, cook it in the furnace and eat it."),
icon = "mcl_fishing_fish_cooked.png",
trigger = {
type = "eat",
item = "mcl_fishing:fish_cooked",
target = 1
}
})
awards.register_achievement("mcl:bakeCake", {
title = S("The Lie"),
@ -131,6 +121,19 @@ awards.register_achievement("mcl:mineWood", {
icon = "default_tree.png",
})
-- Smelting achivements: These are awarded when picking up an item from a furnace
-- output. They are given in mcl_furnaces.
awards.register_achievement("mcl:acquireIron", {
title = S("Aquire Hardware"),
description = S("Take an iron ingot from a furnace's output slot.\nHint: To smelt an iron ingot, put a fuel (like coal) and iron ore into a furnace."),
icon = "default_steel_ingot.png",
})
awards.register_achievement("mcl:cookFish", {
title = S("Delicious Fish"),
description = S("Take a cooked fish from a furnace.\nHint: Use a fishing rod to catch a fish and cook it in a furnace."),
icon = "mcl_fishing_fish_cooked.png",
})
-- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.)
awards.register_achievement("mcl:n_placeDispenser", {

@ -2,3 +2,4 @@ mcl_init
mcl_core
mcl_sounds
mcl_craftguide
mcl_achievements

@ -113,6 +113,17 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
return stack:get_count()
end
local function on_metadata_inventory_take(pos, listname, index, stack, player)
-- Award smelting achievements
if listname == "dst" then
if stack:get_name() == "mcl_core:iron_ingot" then
awards.unlock(player:get_player_name(), "mcl:acquireIron")
elseif stack:get_name() == "mcl_fishing:fish_cooked" then
awards.unlock(player:get_player_name(), "mcl:cookFish")
end
end
end
local function swap_node(pos, name)
local node = minetest.get_node(pos)
if node.name == name then
@ -296,6 +307,7 @@ minetest.register_node("mcl_furnaces:furnace", {
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
on_metadata_inventory_take = on_metadata_inventory_take,
on_receive_fields = craftguide,
_mcl_blast_resistance = 17.5,
_mcl_hardness = 3.5,
@ -336,6 +348,7 @@ minetest.register_node("mcl_furnaces:furnace_active", {
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_move = allow_metadata_inventory_move,
allow_metadata_inventory_take = allow_metadata_inventory_take,
on_metadata_inventory_take = on_metadata_inventory_take,
on_receive_fields = craftguide,
_mcl_blast_resistance = 17.5,
_mcl_hardness = 3.5,