[Mod] Sfinv Unified Inventory [0.1][unified_inventory]
- rubenwardy
- Moderator
- Posts: 6972
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
[Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Adds unified inventory features to sfinv.
This mod implements a fake unified inventory API and passes usage through to sfinv
Download: https://github.com/rubenwardy/sfinv_uni ... master.zip
GitHub: https://github.com/rubenwardy/sfinv_unified_inventory
Depends: sfinv (is in Minetest Game 0.4.15) and sfinv_buttons
Supports: creative and sethome (from Minetest Game)
License: LGPL 2 or later
Some code was reused from the original Unified Inventory - (C) 2012-2014 Maciej Kasatkin (RealBadAngel), LGPLv2+
TODO: bags, craft guide, refill slot
Last edited by rubenwardy on Sat Dec 31, 2016 01:00, edited 3 times in total.
- mahmutelmas06
- Member
- Posts: 367
- Joined: Mon Mar 02, 2015 13:10
- GitHub: mahmutelmas06
- IRC: mahmutelmas06
- In-game: masum
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
It doesnt add buttons. I still see More tab even i added sfinv_buttons_use_icon_bar = true to config.
- rubenwardy
- Moderator
- Posts: 6972
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
You need to apply the pr I posted in the forum topic
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
How about Journalist/Note-taker: appends an entry to your travel-log (book-with-text),rubenwardy wrote:TODO: bags, craft guide, refill slot
i.e. date and coordinates.
'My' wiki-pages: Build-a-home - basic-robot - basic_robot_csm - basic-machines - digtron - xdecor -
Map-Database
Map-Database
- Warrior_4_Christ
- Member
- Posts: 30
- Joined: Thu Oct 27, 2016 18:16
- GitHub: Warrior-4-Christ
- In-game: Warrior_4_Christ
- Location: Palm Bay, FL U.S.
- Contact:
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
How long do you think it would take for craft guide to be added? I run a server with lots of mods and people need the craft guide to fully experience the game. :)TODO: bags, craft guide, refill slot
For God so loved the world that He gave his only begotten Son, that whosoever believeth in Him should not perish, but have everlasting life. -- John 3:16 KJV
____
| [] []|
| _>/
____
| [] []|
| _>/
-
- Member
- Posts: 1118
- Joined: Mon Dec 29, 2014 08:07
- Location: USA
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
rubenwardy,
after figuring out which forum post you were actually talking about regarding the PR, i manually edited the init.lua from sfinv_buttons, to include the code on your git. not all of us are users of git source code management, and general non IT users, probably not at all.
I get an error regarding a missing end to an if statement at line 52. there follows an elseif, and so I'm not sure if I should add the end before the else if, or try to trace the lua to find which actual if is missing its related end.
Any help?
Thanks,
Shad MOrdre
after figuring out which forum post you were actually talking about regarding the PR, i manually edited the init.lua from sfinv_buttons, to include the code on your git. not all of us are users of git source code management, and general non IT users, probably not at all.
I get an error regarding a missing end to an if statement at line 52. there follows an elseif, and so I'm not sure if I should add the end before the else if, or try to trace the lua to find which actual if is missing its related end.
Any help?
Thanks,
Shad MOrdre
- rubenwardy
- Moderator
- Posts: 6972
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
- TumeniNodes
- Member
- Posts: 2941
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Ummm, how the heck did I not see this until now? 0_o
Downloading with sfinv buttons to try out.
Downloading with sfinv buttons to try out.
A Wonderful World
- rubenwardy
- Moderator
- Posts: 6972
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
I think I'm going to deprecate this, and instead write mods for sfinv to add UI features. Adding a compatibility layer is just asking for trouble, I feel
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Deprecate or depreciate? It's still got value to me. I like the look of the buttons on the side, and the extra width of the formspec because of it. Our mods and extra code is so intertwined that pulling that layer out of the server will be like pulling teeth. I'm likely to keep it as long as I can.
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
- TumeniNodes
- Member
- Posts: 2941
- Joined: Fri Feb 26, 2016 19:49
- GitHub: TumeniNodes
- IRC: tumeninodes
- In-game: TumeniNodes
- Location: in the dark recesses of the mind
- Contact:
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
you're a poopie head. just merge Wuzzy's buttons, and write this setup as one mod and then add mods to add addtl UI features. :Prubenwardy wrote:I think I'm going to deprecate this, and instead write mods for sfinv to add UI features. Adding a compatibility layer is just asking for trouble, I feel
I'm tired... headin to bed (I just wanted to call you a poopie head, the rest was sporadic rambling) ; )
A Wonderful World
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Hi, I read your tutorial for sfinv and it states that I can use is_in_nav to limit tab display per privilege. I am unclear however how to use it. Is it a property of sfinv page? If so, this should work but it does not:
The error is: attempt to call method 'get_privs' (a nil value).
Code: Select all
sfinv.register_page("mymod:mytab", {
title = "mytabname",
get = function(self, player, context)
return sfinv.make_formspec(player, context,
"label[0.1,0.1;Hello world!]", true)
end,
is_in_nav = function(self, player, context)
local privs = player:get_privs()
return privs.server
end,
})
- rubenwardy
- Moderator
- Posts: 6972
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
use minetest.check_player_privs(player, { server = true})apienk wrote:Hi, I read your tutorial for sfinv and it states that I can use is_in_nav to limit tab display per privilege. I am unclear however how to use it. Is it a property of sfinv page? If so, this should work but it does not:
The error is: attempt to call method 'get_privs' (a nil value).Code: Select all
sfinv.register_page("mymod:mytab", { title = "mytabname", get = function(self, player, context) return sfinv.make_formspec(player, context, "label[0.1,0.1;Hello world!]", true) end, is_in_nav = function(self, player, context) local privs = player:get_privs() return privs.server end, })
Code: Select all
sfinv.register_page("mymod:mytab", {
title = "mytabname",
get = function(self, player, context)
return sfinv.make_formspec(player, context,
"label[0.1,0.1;Hello world!]", true)
end,
is_in_nav = function(self, player, context)
return minetest.check_player_privs(player, { server = true})
end,
})
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Thanks, it worked.
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
I dislike layout of buttons on right side, does not feels aesthetic enough.
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
How would I register a sfinv page that contains two slots
That's it, just two slots
That's it, just two slots
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
I have an code but it doesn't work
It is the sfinv.register_page row that doesn't work
It is the sfinv.register_page row that doesn't work
Code: Select all
sfinv = minetest.get_modpath("sfinv")
if minetest.get_modpath("sfinv") then
sfinv.register_page("myadmin:myadmin", {
title = "admin",
get = function(self, player, context)
local players = {}
context.myadmin_players = players
-- Using an array to build a formspec is considerably faster
local formspec = {
"textlist[0.1,0.1;7.8,3;playerlist;"
}
-- Add all players to the text list, and to the players list
local is_first = true
for _ , player in pairs(minetest.get_connected_players()) do
local player_name = player:get_player_name()
players[#players + 1] = player_name
if not is_first then
formspec[#formspec + 1] = ","
end
formspec[#formspec + 1] =
minetest.formspec_escape(player_name)
is_first = false
end
formspec[#formspec + 1] = "]"
-- Add buttons
formspec[#formspec + 1] = "button[0.1,3.3;2,1;kick;Kick]"
formspec[#formspec + 1] = "button[2.1,3.3;2,1;ban;Kick + Ban]"
-- Wrap the formspec in sfinv's layout
-- (ie: adds the tabs and background)
return sfinv.make_formspec(player, context,
table.concat(formspec, ""), false)
end,
on_player_receive_fields = function(self, player, context, fields)
-- text list event, check event type and set index if selection changed
if fields.playerlist then
local event = minetest.explode_textlist_event(fields.playerlist)
if event.type == "CHG" then
context.myadmin_selected_idx = event.index
end
-- Kick button was pressed
elseif fields.kick then
local player_name =
context.myadmin_players[context.myadmin_selected_idx]
if player_name then
minetest.chat_send_player(player:get_player_name(),
"Kicked " .. player_name)
minetest.kick_player(player_name)
end
-- Ban button was pressed
elseif fields.ban then
local player_name =
context.myadmin_players[context.myadmin_selected_idx]
if player_name then
minetest.chat_send_player(player:get_player_name(),
"Banned " .. player_name)
minetest.ban_player(player_name)
minetest.kick_player(player_name, "Banned")
end
end
end,
is_in_nav = function(self, player, context)
local privs = minetest.get_player_privs(player:get_player_name())
local function on_grant_revoke(grantee, granter, priv)
if priv ~= "kick" and priv ~= "ban" then
return
end
local player = minetest.get_player_by_name(grantee)
if not player then
return
end
local context = sfinv.get_or_create_context(player)
if context.page ~= "myadmin:myadmin" then
return
end
sfinv.set_player_inventory_formspec(player, context)
end
minetest.register_on_priv_grant(on_grant_revoke)
minetest.register_on_priv_revoke(on_grant_revoke)
return privs.kick or privs.ban
end,
on_enter = function(self, player, context)
end,
on_leave = function(self, player, context)
end,
})
end
- Lone_Wolf
- Member
- Posts: 2576
- Joined: Sun Apr 09, 2017 05:50
- GitHub: LoneWolfHT
- IRC: LandarVargan
- In-game: LandarVargan
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Just delete that first line and it should workMiniontoby wrote:I have an code but it doesn't work
It is the sfinv.register_page row that doesn't work
Code: Select all
sfinv = minetest.get_modpath("sfinv") if minetest.get_modpath("sfinv") then sfinv.register_page("myadmin:myadmin", { title = "admin", get = function(self, player, context) local players = {} context.myadmin_players = players -- Using an array to build a formspec is considerably faster local formspec = { "textlist[0.1,0.1;7.8,3;playerlist;" } -- Add all players to the text list, and to the players list local is_first = true for _ , player in pairs(minetest.get_connected_players()) do local player_name = player:get_player_name() players[#players + 1] = player_name if not is_first then formspec[#formspec + 1] = "," end formspec[#formspec + 1] = minetest.formspec_escape(player_name) is_first = false end formspec[#formspec + 1] = "]" -- Add buttons formspec[#formspec + 1] = "button[0.1,3.3;2,1;kick;Kick]" formspec[#formspec + 1] = "button[2.1,3.3;2,1;ban;Kick + Ban]" -- Wrap the formspec in sfinv's layout -- (ie: adds the tabs and background) return sfinv.make_formspec(player, context, table.concat(formspec, ""), false) end, on_player_receive_fields = function(self, player, context, fields) -- text list event, check event type and set index if selection changed if fields.playerlist then local event = minetest.explode_textlist_event(fields.playerlist) if event.type == "CHG" then context.myadmin_selected_idx = event.index end -- Kick button was pressed elseif fields.kick then local player_name = context.myadmin_players[context.myadmin_selected_idx] if player_name then minetest.chat_send_player(player:get_player_name(), "Kicked " .. player_name) minetest.kick_player(player_name) end -- Ban button was pressed elseif fields.ban then local player_name = context.myadmin_players[context.myadmin_selected_idx] if player_name then minetest.chat_send_player(player:get_player_name(), "Banned " .. player_name) minetest.ban_player(player_name) minetest.kick_player(player_name, "Banned") end end end, is_in_nav = function(self, player, context) local privs = minetest.get_player_privs(player:get_player_name()) local function on_grant_revoke(grantee, granter, priv) if priv ~= "kick" and priv ~= "ban" then return end local player = minetest.get_player_by_name(grantee) if not player then return end local context = sfinv.get_or_create_context(player) if context.page ~= "myadmin:myadmin" then return end sfinv.set_player_inventory_formspec(player, context) end minetest.register_on_priv_grant(on_grant_revoke) minetest.register_on_priv_revoke(on_grant_revoke) return privs.kick or privs.ban end, on_enter = function(self, player, context) end, on_leave = function(self, player, context) end, }) end
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Then minetest doesn't know what sfinv is
- rubenwardy
- Moderator
- Posts: 6972
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
You need to depend on sfinv in mod.conf (or depends.txt)Miniontoby wrote:Then minetest doesn't know what sfinv is
sfinv is a table, but you're replacing it with a string
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Thanks rubenwardy
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
any chance to add support for bags, craft guide, refill slot
how can i get it to work under minetest?
thx for info.
how can i get it to work under minetest?
thx for info.
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: [Mod] Sfinv Unified Inventory [0.1][unified_inventory]
Hi cHyper, use the Unified Inventory. Its already in that mod, but here at sfinv not.
Or use: Inventorybags
Who is online
Users browsing this forum: No registered users and 20 guests