Add i3 support (WIP)

master
Jordan Irwin 2021-07-04 16:53:49 -07:00
parent b5eb290fbd
commit 7cc76a117a
4 changed files with 20 additions and 3 deletions

View File

@ -5,5 +5,4 @@ TODO:
- add chat command to show formspec in case suppored UI handler not available
- support protection mods (don't allow bookmarks to be set in protected areas that player can't access)
- areas
- support inventory mods:
- i3
- fix i3 support

View File

@ -2,6 +2,7 @@
v1.1
----
- added unified_inventory support
- added i3 support
v1.0
----

View File

@ -5,4 +5,4 @@ version = 1.0
license = MIT
author = Jordan Irwin (AntumDeluge)
depends = wdata
optional_depends = sfinv_buttons, unified_inventory, simple_protection
optional_depends = sfinv_buttons, unified_inventory, i3, simple_protection

17
ui.lua
View File

@ -2,6 +2,7 @@
local S = core.get_translator(pbmarks.modname)
local ui_handlers = {
"i3",
"sfinv_buttons",
"unified_inventory",
}
@ -9,6 +10,22 @@ local ui_handlers = {
local handler_available = false
if core.global_exists("i3") then
i3.new_tab({
name = pbmarks.modname,
description = S("Personal Bookmarks"),
formspec = function(player, data, fs)
-- FIXME:
-- - use i3 widgets
-- - inventory widgets are missing after close
i3.set_tab(player, "inventory")
pbmarks.show_formspec(player:get_player_name(), {noback=true})
end,
})
handler_available = true
end
if core.global_exists("sfinv_buttons") then
sfinv_buttons.register_button(pbmarks.modname, {
title = S("Personal Bookmarks"),