Add sfinv_buttons support

master
Wuzzy 2016-12-07 17:54:19 +01:00
parent a690421fc0
commit 7d27703aab
3 changed files with 18 additions and 6 deletions

View File

@ -3,9 +3,11 @@ and power users.
Current version: 1.2.0
Use the server command `/treeform` to open the form. If you use Unified Inventory,
there's a new button in your inventory menu for this. Usage help for this form is
provided in the form itself.
If you use Minetest Game or Unified Inventory there's a new button in your
inventory menu for opening the form. Alternatively, you can always Use the
server command `/treeform`.
Usage help for this form is provided in the form itself.
This mod also has an API for managing the tree database. See `API.md` for more
information.

View File

@ -1 +1,2 @@
unified_inventory?
sfinv_buttons?

View File

@ -1269,14 +1269,23 @@ minetest.register_on_joinplayer(ltool.join)
minetest.register_on_shutdown(ltool.save_to_file)
local button_action = function(player)
ltool.show_treeform(player:get_player_name())
end
if minetest.get_modpath("unified_inventory") ~= nil then
unified_inventory.register_button("ltool", {
type = "image",
image = "ltool_sapling.png",
tooltip = "L-System Tree Utility",
action = function(player)
ltool.show_treeform(player:get_player_name())
end,
action = button_action,
})
end
if minetest.get_modpath("sfinv_buttons") ~= nil then
sfinv_buttons.register_button("ltool", {
title = "L-System Tree Utility",
image = "ltool_sapling.png",
action = button_action,
})
end