From 602058716f7378609df272e53df5ddc1cdcf1d09 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 15 Sep 2017 18:03:37 +0200 Subject: [PATCH] Add achievement for building a Nether portal --- mods/HUD/mcl_achievements/init.lua | 7 +++++++ mods/ITEMS/mcl_portals/depends.txt | 1 + mods/ITEMS/mcl_portals/portal_nether.lua | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 003de726..992d3ea6 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -161,6 +161,13 @@ awards.register_achievement("mcl:snipeSkeleton", { icon = "mcl_throwing_bow.png", }) +-- Triggered in mcl_portals +awards.register_achievement("mcl:buildNetherPortal", { + title = S("Into the Nether"), + description = S("Use obsidian and flint and steel to construct a Nether portal."), + icon = "default_obsidian.png", +}) + -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) if non_pc_achievements then diff --git a/mods/ITEMS/mcl_portals/depends.txt b/mods/ITEMS/mcl_portals/depends.txt index c61520b4..3ba18d1c 100644 --- a/mods/ITEMS/mcl_portals/depends.txt +++ b/mods/ITEMS/mcl_portals/depends.txt @@ -5,4 +5,5 @@ mcl_fire mcl_nether mcl_end mcl_particles +awards? doc? diff --git a/mods/ITEMS/mcl_portals/portal_nether.lua b/mods/ITEMS/mcl_portals/portal_nether.lua index 56594a43..b4da5f7a 100644 --- a/mods/ITEMS/mcl_portals/portal_nether.lua +++ b/mods/ITEMS/mcl_portals/portal_nether.lua @@ -455,6 +455,12 @@ minetest.override_item("mcl_core:obsidian", { local portal_placed = make_portal(pos) if portal_placed and minetest.get_modpath("doc") then doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:portal") + + -- Achievement for finishing a Nether portal TO the Nether + local _, dim = mcl_util.y_to_layer(pos.y) + if minetest.get_modpath("awards") and dim ~= "nether" and user:is_player() then + awards.unlock(user:get_player_name(), "mcl:buildNetherPortal") + end else local node = minetest.get_node(pointed_thing.above) if node.name ~= "mcl_portals:portal" then