From 419169d06b71f7c2eb413739c070449dc2f387d8 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 5 Mar 2017 23:58:26 +0100 Subject: [PATCH] Achievements: Delicious Fish, Acquire Hardware --- mods/HUD/mcl_achievements/init.lua | 23 +++++++++++++---------- mods/ITEMS/mcl_furnaces/depends.txt | 1 + mods/ITEMS/mcl_furnaces/init.lua | 13 +++++++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index cc79db4550..ca807e0b22 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -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", { diff --git a/mods/ITEMS/mcl_furnaces/depends.txt b/mods/ITEMS/mcl_furnaces/depends.txt index b264f4824b..ac2cde5ca8 100644 --- a/mods/ITEMS/mcl_furnaces/depends.txt +++ b/mods/ITEMS/mcl_furnaces/depends.txt @@ -2,3 +2,4 @@ mcl_init mcl_core mcl_sounds mcl_craftguide +mcl_achievements diff --git a/mods/ITEMS/mcl_furnaces/init.lua b/mods/ITEMS/mcl_furnaces/init.lua index a0772ca571..501346bae6 100644 --- a/mods/ITEMS/mcl_furnaces/init.lua +++ b/mods/ITEMS/mcl_furnaces/init.lua @@ -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,