modernize mods with some small adjustments
This commit is contained in:
parent
37c6cbba99
commit
6cf900f31d
@ -1 +0,0 @@
|
|||||||
creative
|
|
4
creative_maxstack/mod.conf
Normal file
4
creative_maxstack/mod.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name = creative_maxstack
|
||||||
|
description = Set all items to max stack size in creative inventory
|
||||||
|
depends = creative
|
||||||
|
|
14
sfinv_buttons/API.md
Normal file
14
sfinv_buttons/API.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
New buttons can be registered using the next API call
|
||||||
|
```
|
||||||
|
sfinv_buttons.register_button(button_name, {
|
||||||
|
-- mandatory
|
||||||
|
image = Texture file shown on button
|
||||||
|
action = function(player, context, content, show_inv). Called if button is pressed
|
||||||
|
|
||||||
|
-- optional
|
||||||
|
title = Text shown in Tooltip (part 1)
|
||||||
|
tooltip = Text shown in Tooltip (Part 2)
|
||||||
|
position = Number. If given the mod try to place the button to this position
|
||||||
|
show = function(player, context, content, show_inv). Allow show or hide button dynamically
|
||||||
|
})
|
||||||
|
```
|
@ -1,2 +0,0 @@
|
|||||||
smart_sfinv_api
|
|
||||||
intllib?
|
|
@ -47,7 +47,7 @@ smart_sfinv_api.register_enhancement({
|
|||||||
local retval = ""
|
local retval = ""
|
||||||
|
|
||||||
for idx = 1, last_button do
|
for idx = 1, last_button do
|
||||||
def = sfinv_buttons.registered_buttons[idx]
|
local def = sfinv_buttons.registered_buttons[idx]
|
||||||
|
|
||||||
local x = 8.1 + math.floor(idx / sfinv_buttons.MAX_ROWS)
|
local x = 8.1 + math.floor(idx / sfinv_buttons.MAX_ROWS)
|
||||||
local y = (idx - 1) % sfinv_buttons.MAX_ROWS
|
local y = (idx - 1) % sfinv_buttons.MAX_ROWS
|
||||||
@ -85,9 +85,9 @@ smart_sfinv_api.register_enhancement({
|
|||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local button_prefix_len = button_prefix:len()
|
local button_prefix_len = button_prefix:len()
|
||||||
for idx = 1, last_button do
|
for idx = 1, last_button do
|
||||||
def = sfinv_buttons.registered_buttons[idx]
|
local def = sfinv_buttons.registered_buttons[idx]
|
||||||
if def and fields[def.button_name] and def.action then
|
if def and fields[def.button_name] and def.action then
|
||||||
def.action(player)
|
def.action(player, context, content, show_inv)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
3
sfinv_buttons/mod.conf
Normal file
3
sfinv_buttons/mod.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name = sfinv_buttons
|
||||||
|
description = Allow additional buttons in sfinv inventory on the right site
|
||||||
|
depends = smart_sfinv_api
|
24
smart_sfinv_api/API.md
Normal file
24
smart_sfinv_api/API.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Smart inventory can be enhanced using the API call
|
||||||
|
|
||||||
|
```
|
||||||
|
smart_sfinv_api.register_enhancement(enhancement_def)
|
||||||
|
```
|
||||||
|
enhancement_def is a lua table that contains the next values:
|
||||||
|
|
||||||
|
Methods:
|
||||||
|
- make_formspec(enhancement_def, player, context, content, show_inv) - Allow to modify page formspec in context
|
||||||
|
- get_nav_fs(enhancement_def, player, context, nav, current_idx) - Allow to modify shown tabs (in nav table) before sfinv creates tab header
|
||||||
|
- receive_fields(handler, player, context, fields) - Receive fields processing for new elements in enhancement
|
||||||
|
|
||||||
|
Method does set Attributes:
|
||||||
|
- enh.formspec_size - Overrides the default size (size[8,9.1])
|
||||||
|
- enh.formspec_size_add_w - Overssides the defaults size - additional with
|
||||||
|
- enh.formspec_size_add_h - Overssides the defaults size - additional height
|
||||||
|
- enh.theme_main - Theme - Additional formspec appended at begin of sfinv formspec
|
||||||
|
|
||||||
|
- enh.formspec_before_navfs - Additional formspec string appended before get_nav_fs tab header
|
||||||
|
- enh.custom_nav_fs - Custom formspec replaces the get_nav_fs tab header
|
||||||
|
- enh.formspec_after_navfs - Additional formspec string appended after get_nav_fs tab header and before content
|
||||||
|
- enh.formspec_after_content - Additional formspec string appended after content
|
||||||
|
- enh.theme_inv - Additional formspec string appended before player inventory is shown
|
||||||
|
})
|
@ -1 +0,0 @@
|
|||||||
sfinv
|
|
@ -20,8 +20,8 @@ Method does set Attributes:
|
|||||||
- enh.formspec_before_navfs
|
- enh.formspec_before_navfs
|
||||||
- enh.formspec_after_navfs
|
- enh.formspec_after_navfs
|
||||||
- enh.formspec_after_content
|
- enh.formspec_after_content
|
||||||
- theme_main - Theme
|
- enh.theme_main - Theme
|
||||||
- theme_inv - Player inventory fields
|
- enh.theme_inv - Player inventory fields
|
||||||
- enh.custom_nav_fs - if set, default is skipped
|
- enh.custom_nav_fs - if set, default is skipped
|
||||||
]]
|
]]
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ function sfinv.make_formspec(player, context, content, show_inv, size)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local tmp = enh_handler_class.patch_2275 and {
|
local tmp = {
|
||||||
new_size or handler.formspec_size,
|
new_size or handler.formspec_size,
|
||||||
handler.theme_main,
|
handler.theme_main,
|
||||||
handler.formspec_before_navfs,
|
handler.formspec_before_navfs,
|
||||||
@ -119,17 +119,7 @@ function sfinv.make_formspec(player, context, content, show_inv, size)
|
|||||||
show_inv and handler.theme_inv or "",
|
show_inv and handler.theme_inv or "",
|
||||||
content,
|
content,
|
||||||
handler.formspec_after_content
|
handler.formspec_after_content
|
||||||
} or { -- can be removed if patch_2275 merged to upstream
|
|
||||||
new_size or handler.formspec_size,
|
|
||||||
handler.theme_main,
|
|
||||||
handler.formspec_before_navfs,
|
|
||||||
nav_fs,
|
|
||||||
handler.formspec_after_navfs,
|
|
||||||
content,
|
|
||||||
show_inv and handler.theme_inv or "",
|
|
||||||
handler.formspec_after_content
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return table.concat(tmp, "")
|
return table.concat(tmp, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -154,13 +144,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------
|
-----------------------------------------------
|
||||||
-- Initialization: hacky access to some default variables
|
--- Initialization: hacky access to some default variables
|
||||||
----------------------------------------------
|
-----------------------------------------------
|
||||||
local _dummy_page = orig_make_formspec(nil, {}, "|", true, nil)
|
local _dummy_page = orig_make_formspec(nil, {}, "|", true, nil)
|
||||||
enh_handler_class.formspec_size, enh_handler_class.theme_main, enh_handler_class.theme_inv = _dummy_page:match("(size%[[%d.,]+%]*)([^|]*)|([^|]*)")
|
enh_handler_class.formspec_size, enh_handler_class.theme_inv, enh_handler_class.theme_main = _dummy_page:match("(size%[[%d.,]+%]*)([^|]*)|([^|]*)")
|
||||||
if enh_handler_class.theme_inv == "" then -- Support for https://github.com/minetest/minetest_game/pull/2275
|
|
||||||
enh_handler_class.patch_2275 = true
|
|
||||||
enh_handler_class.theme_inv = enh_handler_class.theme_main
|
|
||||||
enh_handler_class.theme_main = ""
|
|
||||||
end
|
|
||||||
|
3
smart_sfinv_api/mod.conf
Normal file
3
smart_sfinv_api/mod.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name = smart_sfinv_api
|
||||||
|
description = Smart Enhancements API for sfinv inventory
|
||||||
|
depends = sfinv
|
@ -1 +0,0 @@
|
|||||||
creative
|
|
@ -47,7 +47,9 @@ return {
|
|||||||
maidroid_core = 'maidroid',
|
maidroid_core = 'maidroid',
|
||||||
maidroid_tool = 'maidroid',
|
maidroid_tool = 'maidroid',
|
||||||
|
|
||||||
shields = '3d_armor',
|
["3d_armor"] = 'armor',
|
||||||
|
shields = 'armor',
|
||||||
|
armor_addon = 'armor',
|
||||||
},
|
},
|
||||||
by_group = {
|
by_group = {
|
||||||
-- Order all stairs and slabs to the stairs group
|
-- Order all stairs and slabs to the stairs group
|
||||||
|
3
smart_sfinv_creative_bymod/mod.conf
Normal file
3
smart_sfinv_creative_bymod/mod.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name = smart_sfinv_creative_bymod
|
||||||
|
description = Split creative page to multiple pages by mod instead of "nodes","items","tools"
|
||||||
|
depends = creative
|
@ -1 +0,0 @@
|
|||||||
smart_sfinv_api
|
|
3
smart_sfinv_creative_sitebar/mod.conf
Normal file
3
smart_sfinv_creative_sitebar/mod.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name = smart_sfinv_creative_sitebar
|
||||||
|
description = Unify creative pages to one, add grouping to site bar on the left site
|
||||||
|
depends = smart_sfinv_api
|
@ -1,2 +0,0 @@
|
|||||||
smart_sfinv_api
|
|
||||||
sfinv_buttons
|
|
3
smart_sfinv_tweaks/mod.conf
Normal file
3
smart_sfinv_tweaks/mod.conf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name = smart_sfinv_tweaks
|
||||||
|
description = Adds additional inventory related buttons
|
||||||
|
depends = smart_sfinv_api, sfinv_buttons
|
Loading…
x
Reference in New Issue
Block a user