Add unified_inventory support
parent
32497d3cc5
commit
1039b712ac
|
@ -43,8 +43,8 @@ A [Minetest][] mod that allows players to create a limited number of personal bo
|
|||
|
||||
### Requirements:
|
||||
|
||||
- Depends: [wdata](https://content.minetest.net/packages/AntumDeluge/wdata/), [sfinv_buttons](https://content.minetest.net/packages/Wuzzy/sfinv_buttons/)
|
||||
- Optional depends: [simple_protection](https://content.minetest.net/packages/Krock/simple_protection/)
|
||||
- Depends: [wdata](https://content.minetest.net/packages/AntumDeluge/wdata/)
|
||||
- Optional depends: [sfinv_buttons](https://content.minetest.net/packages/Wuzzy/sfinv_buttons/), [unified_inventory](https://content.minetest.net/packages/RealBadAngel/unified_inventory/), [simple_protection](https://content.minetest.net/packages/Krock/simple_protection/)
|
||||
|
||||
### Links:
|
||||
|
||||
|
|
1
TODO.txt
1
TODO.txt
|
@ -5,5 +5,4 @@ TODO:
|
|||
- support protection mods (don't allow bookmarks to be set in protected areas that player can't access)
|
||||
- areas
|
||||
- support inventory mods:
|
||||
- unified_inventory
|
||||
- i3
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
|
||||
v1.1
|
||||
----
|
||||
- added unified_inventory support
|
||||
|
||||
v1.0
|
||||
----
|
||||
- initial release
|
||||
|
|
4
mod.conf
4
mod.conf
|
@ -4,5 +4,5 @@ description = Allows players to create a limited number of personal bookmarks to
|
|||
version = 1.0
|
||||
license = MIT
|
||||
author = Jordan Irwin (AntumDeluge)
|
||||
depends = wdata, sfinv_buttons
|
||||
optional_depends = simple_protection
|
||||
depends = wdata
|
||||
optional_depends = sfinv_buttons, unified_inventory, simple_protection
|
||||
|
|
40
ui.lua
40
ui.lua
|
@ -3,19 +3,39 @@ local S = core.get_translator(pbmarks.modname)
|
|||
|
||||
local ui_handlers = {
|
||||
"sfinv_buttons",
|
||||
"unified_inventory",
|
||||
}
|
||||
|
||||
if not core.global_exists("sfinv_buttons") then
|
||||
local handler_available = false
|
||||
|
||||
|
||||
if core.global_exists("sfinv_buttons") then
|
||||
sfinv_buttons.register_button(pbmarks.modname, {
|
||||
title = S("Personal Bookmarks"),
|
||||
image = "pbmarks_check.png",
|
||||
action = function(player)
|
||||
pbmarks.show_formspec(player:get_player_name())
|
||||
end,
|
||||
})
|
||||
|
||||
handler_available = true
|
||||
end
|
||||
|
||||
if core.global_exists("unified_inventory") then
|
||||
unified_inventory.register_button(pbmarks.modname, {
|
||||
type = "image",
|
||||
image = "pbmarks_check.png",
|
||||
tooltip = S("Personal Bookmarks"),
|
||||
action = function(player)
|
||||
pbmarks.show_formspec(player:get_player_name())
|
||||
end,
|
||||
})
|
||||
|
||||
handler_available = true
|
||||
end
|
||||
|
||||
if not handler_available then
|
||||
pbmarks.log("warning", "compatible UI handler not available, please install one of "
|
||||
.. core.serialize(ui_handlers):gsub("return ", ""))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
sfinv_buttons.register_button(pbmarks.modname, {
|
||||
title = S("Personal Bookmarks"),
|
||||
image = "pbmarks_check.png",
|
||||
action = function(player)
|
||||
pbmarks.show_formspec(player:get_player_name())
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue