From dd962f04a1016500a2a27db4124b2217c684cdfa Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sun, 21 Aug 2022 01:33:25 -0600 Subject: [PATCH] removing leftovers --- df_achievements/init.lua | 30 ++++++++++++------------------ df_achievements/travel.lua | 30 ------------------------------ 2 files changed, 12 insertions(+), 48 deletions(-) diff --git a/df_achievements/init.lua b/df_achievements/init.lua index 77c423e..d9e5140 100644 --- a/df_achievements/init.lua +++ b/df_achievements/init.lua @@ -57,27 +57,21 @@ awards.register_on_unlock(function(player_name, def) 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 - 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 + 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 + player_awards.dfcaverns_achievements[achievement_parent] = count + awards.save() + if count >= total then + minetest.after(4, awards.unlock, player_name, achievement_parent) + end end end) diff --git a/df_achievements/travel.lua b/df_achievements/travel.lua index 6b09bd9..377d3fd 100644 --- a/df_achievements/travel.lua +++ b/df_achievements/travel.lua @@ -139,36 +139,6 @@ minetest.register_globalstep(function(dtime) end end) -local upper_biome_achievements = {"dfcaverns_visit_tower_cap", "dfcaverns_visit_fungiwood", "dfcaverns_visit_goblin_cap", "dfcaverns_visit_spore_tree", "dfcaverns_visit_tunnel_tube", "dfcaverns_visit_nethercap", "dfcaverns_visit_blood_thorn", "dfcaverns_visit_black_cap", "dfcaverns_visit_sunless_sea"} - -local middle_biome_achievements = {"dfcaverns_visit_oil_sea", "dfcaverns_visit_lava_sea", "dfcaverns_visit_underworld"} - -local primordial_biome_achievements = {"dfcaverns_visit_primordial_jungle", "dfcaverns_visit_primordial_fungal"} - -local all_caverns = {"dfcaverns_visit_all_upper_biomes", "dfcaverns_visit_all_middle_biomes", "dfcaverns_visit_all_primordial_biomes", "dfcaverns_visit_chasm", "dfcaverns_visit_pit"} - -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_visit_all_upper_biomes", unlocked, upper_biome_achievements) - test_list(player_name, "dfcaverns_visit_all_middle_biomes", unlocked, middle_biome_achievements) - test_list(player_name, "dfcaverns_visit_all_primordial_biomes", unlocked, primordial_biome_achievements) - test_list(player_name, "dfcaverns_visit_all_caverns", unlocked, all_caverns) -end) - - ---awards.unlock(name, award) --- local data = awards.players[name] --- local awdef = awards.def[award] --- data.unlocked[award] == award - -- travelogue --biomes