Page 1 of 1
API Feedback and Testing Required: Simple Fast Inventory

Posted:
Thu Jul 07, 2016 15:08
by rubenwardy
Simple Fast Inventory is a new API that may be included in minetest_game that allows mods to register tabs in the inventory (I) formspec like creative does. I would like feedback and testing
Here is the PR:
https://github.com/minetest/minetest_game/pull/1179You can download minetest_game with sfinv here:
https://github.com/rubenwardy/minetest_ ... /sfinv.zipYour phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
sfinv.register_page("mymod:crafting2", {
title = "Crafting2",
get = function(self, player, context, vars)
return sfinv.make_formspec(player, context, vars, [[
list[current_player;craft;1.75,0.5;3,3;]
list[current_player;craftpreview;5.75,1.5;1,1;]
image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]
listring[current_player;main]
listring[current_player;craft]
image[0,4.75;1,1;gui_hb_bg.png]
image[1,4.75;1,1;gui_hb_bg.png]
image[2,4.75;1,1;gui_hb_bg.png]
image[3,4.75;1,1;gui_hb_bg.png]
image[4,4.75;1,1;gui_hb_bg.png]
image[5,4.75;1,1;gui_hb_bg.png]
image[6,4.75;1,1;gui_hb_bg.png]
image[7,4.75;1,1;gui_hb_bg.png]
]], true)
end,
on_player_receive_fields = function(self, player, context, fields)
print(dump(fields))
end
})

Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Thu Jul 07, 2016 18:24
by KCoombes
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
2016-07-07 14:21:58: ERROR[Main]: ServerError: Lua: Runtime error from mod 'sfinv' in callback on_playerReceiveFields(): ...2\bin\..\games\minetest_game\mods\creative/inventory.lua:53: attempt to index local 'inv' (a nil value)
2016-07-07 14:21:58: ERROR[Main]: stack traceback:
2016-07-07 14:21:58: ERROR[Main]: ...2\bin\..\games\minetest_game\mods\creative/inventory.lua:53: in function 'update_creative_inventory'
2016-07-07 14:21:59: ERROR[Main]: ...2\bin\..\games\minetest_game\mods\creative/inventory.lua:89: in function 'get_formspec'
2016-07-07 14:21:59: ERROR[Main]: ...4.14-win32\bin\..\games\minetest_game\mods\sfinv/api.lua:93: in function 'set'
2016-07-07 14:21:59: ERROR[Main]: ...4.14-win32\bin\..\games\minetest_game\mods\sfinv/api.lua:134: in function 'toregister'
2016-07-07 14:21:59: ERROR[Main]: ...etest-0.4.14-win32\bin\..\builtin\game\mod_profiling.lua:154: in function <...etest-0.4.14-win32\bin\..\builtin\game\mod_profiling.lua:150>
2016-07-07 14:21:59: ERROR[Main]: ...p\minetest-0.4.14-win32\bin\..\builtin\game\register.lua:369: in function <...p\minetest-0.4.14-win32\bin\..\builtin\game\register.lua:349>
Nope, but I love the idea!
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Thu Jul 07, 2016 19:06
by rubenwardy
That should never happen, as inv is created on join player. What did you do to cause that?
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Thu Jul 07, 2016 19:09
by rubenwardy
Found the cause, you were trying to use creative when not actually in creative. Fixed.
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Thu Jul 07, 2016 19:22
by KCoombes
Ah, no - I created a vanilla world to test it in, not in creative but no damage enabled - and the crash occurred when I clicked on a tab.
I have redownloaded and installed your fork - now I get no tabs at all!

- screenshot_20160707_151654.png (176.5 KiB) Viewed 2884 times
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Thu Jul 07, 2016 19:41
by rubenwardy
You don't get any tabs because there is only one tab. Enable creative or define more tabs
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Thu Jul 07, 2016 19:43
by KCoombes
Ah, now I see! Very awesome, sir!
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Fri Jul 08, 2016 11:40
by azekill_DIABLO
yes very nice!!!
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Fri Aug 05, 2016 20:48
by rubenwardy
Bump! I'd like testing
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Sat Aug 06, 2016 00:27
by KCoombes
I did play with this a bit after my initial d/l - is there a limit to the number of tabs you can set? I was unable to set a 6th tab.
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Sat Aug 06, 2016 00:35
by rubenwardy
It's only limited by the engine - there's probably not enough space
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Sat Aug 06, 2016 02:39
by Byakuren
What if you stacked tabs on top of each other vertically when they run out of space? Or have scroll buttons for tabs, or something similar.
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Sun Aug 07, 2016 13:48
by azekill_DIABLO
no i think it's just that takes too much memory after all
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Sun Aug 07, 2016 13:50
by rubenwardy
azekill_DIABLO wrote:no i think it's just that takes too much memory after all
?
Memory won't be a problem, by space I meant screen space
Re: API Feedback and Testing Required: Simple Fast Inventory

Posted:
Sun Aug 07, 2016 15:59
by azekill_DIABLO
Oh. sorry. maybe make buttons with small icons would be better.