From 43da09620ed84f13e86b958e52b5c478f01f5227 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 6 Nov 2016 12:05:13 +0100 Subject: [PATCH] Fix bugs when mod is run outside of Minetest Game (#34) --- api.lua | 6 +++++- init.lua | 22 ++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/api.lua b/api.lua index 7d921e1..916441e 100644 --- a/api.lua +++ b/api.lua @@ -463,9 +463,13 @@ function awards.show_to(name, to, sid, text) if sid == nil or sid < 1 then sid = 1 end + local deco = "" + if minetest.global_exists("default") then + deco = default.gui_bg .. default.gui_bg_img + end -- Show formspec to user minetest.show_formspec(to,"awards:awards", - "size[11,5]" .. default.gui_bg .. default.gui_bg_img .. + "size[11,5]" .. deco .. awards.getFormspec(name, to, sid)) end end diff --git a/init.lua b/init.lua index fa029e3..922b936 100644 --- a/init.lua +++ b/init.lua @@ -70,16 +70,18 @@ end -- This award can't be part of Unified Inventory, it would make a circular dependency if minetest.get_modpath("unified_inventory") then - awards.register_achievement("awards_ui_bags", { - title = S("Backpacker"), - description = S("Craft 4 large bags."), - icon = "awards_ui_bags.png", - trigger = { - type = "craft", - item = "unified_inventory:bag_large", - target = 4 - } - }) + if minetest.get_all_craft_recipes("unified_inventory:bag_large") ~= nil then + awards.register_achievement("awards_ui_bags", { + title = S("Backpacker"), + description = S("Craft 4 large bags."), + icon = "awards_ui_bags.png", + trigger = { + type = "craft", + item = "unified_inventory:bag_large", + target = 4 + } + }) + end end if minetest.get_modpath("fire") then