Add sfinv_buttons support

This commit is contained in:
Wuzzy 2016-12-07 19:14:38 +01:00
parent 2b0c044b13
commit b059821156
5 changed files with 22 additions and 5 deletions

View File

@ -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.

View File

@ -1,3 +1,4 @@
intllib?
unified_inventory?
sfinv_buttons?
central_message?

View File

@ -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

View File

@ -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

View File

@ -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 =