Add sfinv_buttons support

This commit is contained in:
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 Current version: 1.2.0
Use the server command `/treeform` to open the form. If you use Unified Inventory, If you use Minetest Game or Unified Inventory there's a new button in your
there's a new button in your inventory menu for this. Usage help for this form is inventory menu for opening the form. Alternatively, you can always Use the
provided in the form itself. 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 This mod also has an API for managing the tree database. See `API.md` for more
information. information.

View File

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

View File

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