From b059821156b512c3efec22e39b2551656d41d32d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 7 Dec 2016 19:14:38 +0100 Subject: Add sfinv_buttons support --- README.md | 4 ++-- depends.txt | 1 + init.lua | 20 +++++++++++++++++--- locale/de.txt | 1 + locale/template.txt | 1 + 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5dc3469..4ab6a08 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Current version: 0.9.0 To open the help, there are multiple ways: - Use the `/doc` chat command. This works always. -- If you use Unified Inventory, click on the blue question mark icon in the - inventory menu +- If you use Unified Inventory or Minetest Game, you will find an extra + button in the inventory The documentation system itself should be more or less self-explanatory. diff --git a/depends.txt b/depends.txt index e5f139a..c6040df 100644 --- a/depends.txt +++ b/depends.txt @@ -1,3 +1,4 @@ intllib? unified_inventory? +sfinv_buttons? central_message? diff --git a/init.lua b/init.lua index 57808ee..e18f345 100644 --- a/init.lua +++ b/init.lua @@ -1197,18 +1197,32 @@ minetest.register_on_leaveplayer(function(player) end) ---[[ Add buttons for inventory mods ]] +local button_action = function(player) + doc.show_doc(player:get_player_name()) +end + -- Unified Inventory if minetest.get_modpath("unified_inventory") ~= nil then unified_inventory.register_button("doc", { type = "image", image = "doc_button_icon_hires.png", tooltip = S("Documentation System"), - action = function(player) - doc.show_doc(player:get_player_name()) - end, + action = button_action, }) end +-- sfinv_buttons +if minetest.get_modpath("sfinv_buttons") ~= nil then + sfinv_buttons.register_button("doc", { + image = "doc_button_icon_lores.png", + tooltip = S("Collection of help texts"), + title = S("Documentation System"), + action = button_action, + }) +end + + + minetest.register_privilege("doc_reveal", { description = S("Allows you to reveal all hidden help entries with /doc_reveal"), give_to_singleplayer = false diff --git a/locale/de.txt b/locale/de.txt index 03864e3..2ad8ff2 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -38,3 +38,4 @@ This is the Documentation System, Version %s. = Dies ist das Dokumentationssyste You haven't chosen a category yet. Please choose one in the category list first. = Sie haben noch keine Kategorie gewählt. Bitte wählen Sie zuerst eine Kategorie in der Kategorienliste aus. You haven't chosen an entry yet. Please choose one in the entry list first. = Sie haben noch keinen Eintrag gewählt. Bitte wählen Sie zuerst einen Eintrag in der Eintragsliste aus. Nameless entry (%s) = Namenloser Eintrag (%s) +Collection of help texts = Sammlung von Hilfetexten diff --git a/locale/template.txt b/locale/template.txt index 415dfd3..a20f982 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -38,3 +38,4 @@ This category is empty. = This is the Documentation System, Version %s. = You haven't chosen a category yet. Please choose one in the category list first. = You haven't chosen an entry yet. Please choose one in the entry list first. = +Collection of help texts = -- cgit v1.2.3