[Mod] Simple Fast Inventory Buttons [1.0.0] [sfinv_buttons]

Post Reply
User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

[Mod] Simple Fast Inventory Buttons [1.0.0] [sfinv_buttons]

by Wuzzy » Post

Adds a tab to your default Minetest Game inventory in which other mods can add simple buttons to access special functionality.

Just open the inventory menu, select the “More” tab and click on a button.

The mod itself does not add these buttons on its own, instead other mods need to depend on this mod.

Example:
Image
(Your inventory menu might look different because of different mods.)
+ Spoiler
Download (and stuff)
Download: sfinv_buttons1.0.0.zip
Attachments
sfinv_buttons1.0.0.zip
(21.58 KiB) Downloaded 886 times
Last edited by Wuzzy on Fri Dec 01, 2017 09:42, edited 9 times in total.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
mahmutelmas06
Member
Posts: 367
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by mahmutelmas06 » Post

This is must have if using default inventory.
Could you also make possible to choose icons only mode? Then there could be buton grid instead of list
My Mods:

Beverage

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by Wuzzy » Post

I don't see an use of an icon-only mode.
IMO it would be less usable since the corresponding text is now hidden inside a tooltip. I think the button+icon variant is the best because the text makes it clear what it is for and the icon makes it easier on the eye.
Also, this tab disables the normal inventory grid to make room for all buttons.

But if I hear feedback from actual users on how they perceive the mod's usability, I'd gladly take it. :-)

But the mod already has a fallback mode if the space for buttons is completely used up: It displays a scrollable text list instead. This means, this mod supports an arbitrary amount of buttons.

However, I would generally not recommend mods to add huge amounts of buttons, to keep things simple. Buttons should only be added for accessing their core functionality, such as the main form.
If a modder would like to add, let's say, a complete “control panel”, adding a new sfinv tab would be better. Note: sfinv is a new Minetest Game mod by rubenwardy, it has a quite powerful API. Interested modders should take a look at it.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
cHyper
Member
Posts: 908
Joined: Fri May 06, 2011 08:49
GitHub: cHyper-0815OL
IRC: cHyper cHyper_de
In-game: cHyper cHyper_0815
Location: Austria
Contact:

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by cHyper » Post

How can i execute a command?
What are the lines of code therefore?

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by Wuzzy » Post

Do you want to learn how to add your own button with this mod?
In this case, read API.md which is included with the mod.

http://repo.or.cz/minetest_sfinv_button ... er:/API.md

If you meant something else, sorry. I have no idea what you want from me. :-(
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
rubenwardy
Moderator
Posts: 6297
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by rubenwardy » Post

Very nice! This should be quite good to make a replacement for unified inventory's button bar

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by hajo » Post

cHyper wrote:How can i execute a command?
Wuzzy wrote:If you meant something else, sorry. I have no idea what you want from me. :-(
Maybe he wants a button that executes a chat-command, like "/privs".

User avatar
cx384
Member
Posts: 502
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by cx384 » Post

Nice mod!
It would be great to have a fake unified inventory mod which automatically converts the unified inventory buttons into simple fast inventory buttons.
Can your read this?

User avatar
cHyper
Member
Posts: 908
Joined: Fri May 06, 2011 08:49
GitHub: cHyper-0815OL
IRC: cHyper cHyper_de
In-game: cHyper cHyper_0815
Location: Austria
Contact:

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by cHyper » Post

hajo wrote:
cHyper wrote:How can i execute a command?
Wuzzy wrote:If you meant something else, sorry. I have no idea what you want from me. :-(
Maybe he wants a button that executes a chat-command, like "/privs".
yes.
i mean chat-commands!
but how can i do that?

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by Wuzzy » Post

It would be great to have a fake unified inventory mod which automatically converts the unified inventory buttons into simple fast inventory buttons.
Or just convince modders to support both mods. The APIs are both relatively simple, so the overhead should be rather small. It's a pity that Unified Inventory has no API documentation whatsoever.
yes.
i mean chat-commands!
but how can i do that?
I fear this is not directly possible as Minetest does not expose a list of registered chat commands.

But what you could do instead is write a mod which adds a button which does the same action of the chat command. If you don't know how to do it, you should either learn how to mod or ask a modder to do it for you.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
rubenwardy
Moderator
Posts: 6297
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by rubenwardy » Post

Wuzzy wrote:
yes.
i mean chat-commands!
but how can i do that?
I fear this is not directly possible as Minetest does not expose a list of registered chat commands.

But what you could do instead is write a mod which adds a button which does the same action of the chat command. If you don't know how to do it, you should either learn how to mod or ask a modder to do it for you.
minetest.chatcommands

See irc commands:

Code: Select all

function(user, args)
	if args == "" then
		return false, "You need a command."
	end
	if not irc_users[user.nick] then
		return false, "You are not logged in."
	end
	local found, _, commandname, params = args:find("^([^%s]+)%s(.+)$")
	if not found then
		commandname = args
	end
	local command = minetest.chatcommands[commandname]
	if not command then
		return false, "Not a valid command."
	end
	if not minetest.check_player_privs(irc_users[user.nick], command.privs) then
		return false, "Your privileges are insufficient."
	end
	minetest.log("action", user.nick.."@IRC runs "
		..args.." as "..irc_users[user.nick])
	return command.func(irc_users[user.nick], (params or ""))
end

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by Wuzzy » Post

Oh, sorry, rubenwardy, for not knowing about the completely undocumented minetest.chatcommands table. :P
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
rubenwardy
Moderator
Posts: 6297
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by rubenwardy » Post

Here! Have a PR: Add icon bar mode - adds an icon bar to every page

Image

Put sfinv_buttons_use_icon_bar = true in minetest.conf to enable

Really I need to make a sfinv.register_on_player_submit_fields function, would make this a lot easier

Also, I made a mod which uses this mod: viewtopic.php?f=9&t=16290

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Simple Fast Inventory Buttons [0.1.0] [sfinv_butto

by Wuzzy » Post

And as soon as the 10th or 11th button is added, this mod breaks.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 1.0.0 released!

by Wuzzy » Post

Version 1.0.0 released!
This mod has been long enough in version 0.1.0, is finished and no bugs have been found. It's about time for an official release. :-)

Not much changed, I just fixed some typos.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
azekill_DIABLO
Member
Posts: 7497
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Simple Fast Inventory Buttons [1.0.0] [sfinv_butto

by azekill_DIABLO » Post

Image

Woohoo!

KCoombes
Member
Posts: 412
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt
Location: SW Florida, USA

Re: [Mod] Simple Fast Inventory Buttons [1.0.0] [sfinv_butto

by KCoombes » Post

Fabulous work, and any chance of making two columns of buttons, instead of one?

Not necro, just wondering if it's possible (best to ask the expert)

User avatar
Hamlet
Member
Posts: 765
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: [Mod] Simple Fast Inventory Buttons [1.0.0] [sfinv_butto

by Hamlet » Post

Updated version: https://git.minetest.land/Hamlet/mevo/s ... nv_buttons

Added:
mod.conf
i18n support (MT engine)
My repositories: Codeberg.org | My ContentDB's page | I'm on PureOS with XFCE

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests