From 00eeeb3eef3d5f57f6d01d2adf655f539c1a3f8e Mon Sep 17 00:00:00 2001
From: Wuzzy <wuzzy2@mail.ru>
Date: Mon, 1 Aug 2016 21:38:19 +0200
Subject: Add support for Unified Inventory

---
 depends.txt                 |   1 +
 init.lua                    |   1 +
 locale/template.txt         |   1 +
 textures/awards_ui_icon.png | Bin 0 -> 3514 bytes
 unified_inventory.lua       |  19 +++++++++++++++++++
 5 files changed, 22 insertions(+)
 create mode 100644 textures/awards_ui_icon.png
 create mode 100644 unified_inventory.lua

diff --git a/depends.txt b/depends.txt
index 77e8d97..dad55b5 100644
--- a/depends.txt
+++ b/depends.txt
@@ -1 +1,2 @@
 intllib?
+unified_inventory?
diff --git a/init.lua b/init.lua
index 2ac26ea..e6e029b 100644
--- a/init.lua
+++ b/init.lua
@@ -25,6 +25,7 @@ end
 
 dofile(minetest.get_modpath("awards").."/api.lua")
 dofile(minetest.get_modpath("awards").."/chat_commands.lua")
+dofile(minetest.get_modpath("awards").."/unified_inventory.lua")
 dofile(minetest.get_modpath("awards").."/triggers.lua")
 awards.set_intllib(S)
 
diff --git a/locale/template.txt b/locale/template.txt
index d0505c8..cba9ce4 100644
--- a/locale/template.txt
+++ b/locale/template.txt
@@ -59,3 +59,4 @@ Deep Down =
 Die below -10000 =
 In space, no one can hear you scream =
 Die above 10000 =
+Awards =
diff --git a/textures/awards_ui_icon.png b/textures/awards_ui_icon.png
new file mode 100644
index 0000000..239ad71
Binary files /dev/null and b/textures/awards_ui_icon.png differ
diff --git a/unified_inventory.lua b/unified_inventory.lua
new file mode 100644
index 0000000..169cdfe
--- /dev/null
+++ b/unified_inventory.lua
@@ -0,0 +1,19 @@
+if minetest.get_modpath("unified_inventory") ~= nil then
+	local S
+	if (intllib) then
+		dofile(minetest.get_modpath("intllib").."/intllib.lua")
+		S = intllib.Getter(minetest.get_current_modname())
+	else
+		S = function ( s ) return s end
+	end
+
+	unified_inventory.register_button("awards", {
+		type = "image",
+		image = "awards_ui_icon.png",
+		tooltip = S("Awards"),
+		action = function(player)
+			local name = player:get_player_name()
+			awards.show_to(name, name, nil, false)
+		end,
+	})
+end
-- 
cgit v1.2.3