[0.4.13] Inventory movement using shift

est31
Member
 
Posts: 172
Joined: Mon Dec 29, 2014 01:49

[0.4.13] Inventory movement using shift

by est31 » Tue Jun 16, 2015 13:55

Today, list rings were merged. This formspec feature can be used to transfer items from inventory to e.g. a chest and back, directly without drag & drop.
However, mod creators have to take action in order to make their mod support that feature.

The basic setup is as follows: with formspec declarations, you build a list ring, by either naming formspec inventory lists, one after another, or using the shorthand listring[]. In fact, in most of the cases (in all with only two inventory lists you want to shift transport between), you will only need the shorthand. That means it can be used for a chest together with an inventory, or a crafting menu.

With the shorthand, a chest would look like this:
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]" ..
"listring[]"

With the slightly more verbose method, it would look like this:
"list[current_name;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]" ..
"listring[current_name;main]"..
"listring[current_player;main]"

The explicit naming allows one to much tighter control the ring.

The inventory list ring is like a linked list of elements, with the last element referencing the first as child, so that it forms a ring. Inventory lists can appear multiple times, so its permitted to do:
"listring[current_name;main]"..
"listring[current_name;main]"..
"listring[current_player;main]"

This allows one to freely specify almost all mappings -- read below for the furnace example.
When you shift-click a stack inside a given inventory list, it will search for the first occurrence inside the list ring, and then put the item into its child list. As its a ring, shift-clicking inside the inventory would successfully put the stack into the chest in the example from above.
Now to a slightly more interesting example, the furnace:
"list[current_name;fuel;2,3;1,1;]"..
"list[current_name;src;2,1;1,1;]"..
"list[current_name;dst;5,1;2,2;]"..
"list[current_player;main;0,5;8,4;]" ..
"listring[current_name;dst]" ..
"listring[current_player;main]" ..
"listring[current_name;src]" ..
"listring[current_player;main]"

There you have a ring
furnace destination -> player inventory -> furnace source -> player inventory

This will put items from the output of the furnace into the inventory, and items from the inventory to the furnace's source. Also, you can put items from the source back to your inventory if you have decided not to smelt/cook them.
however, the last "arrow" player inventory -> furnace destination which crosses the border doesn't have any impact, because "player inventory" already appears at an earlier point.

For a compact description of the listring formspec elements, consult the documentation inside lua_api.txt.
Last edited by est31 on Thu Aug 20, 2015 23:58, edited 1 time in total.
 

User avatar
luizrpgluiz
Member
 
Posts: 17
Joined: Thu Mar 19, 2015 18:11
IRC: luizrpgluiz
In-game: luizinho

Re: [0.4.12-dev] Inventory movement using shift

by luizrpgluiz » Tue Jun 16, 2015 17:59

I hope this function does not have the minetest, I hope one day to test it on Linux and perhaps also in windows
 

ThatGraemeGuy
Member
 
Posts: 126
Joined: Thu Jul 31, 2014 11:02
GitHub: thatgraemeguy
IRC: ThatGraemeGuy
In-game: thatgraemeguy

Re: [0.4.12-dev] Inventory movement using shift

by ThatGraemeGuy » Wed Jun 17, 2015 06:56

I might just be dumb, but I have NO idea what this is or how to use it. :-/
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [0.4.12-dev] Inventory movement using shift

by rubenwardy » Wed Jun 17, 2015 07:37

luizrpgluiz wrote:I hope this function does not have the minetest, I hope one day to test it on Linux and perhaps also in windows


that makes no sense at all; please rephrase.

ThatGraemeGuy wrote:I might just be dumb, but I have NO idea what this is or how to use it. :-/


It's not yet in minetest_game, but it is in this version: https://github.com/Amaz1/minetest_game/tree/listrings

By 0.4.13 or whatever it will be in minetest_game. Just shift+click an item to auto move it (eg: in a chest to move to inventory, vise versa)
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [0.4.12-dev] Inventory movement using shift

by Nathan.S » Wed Jun 17, 2015 16:21

Sounds good, now we just need drag support so we can drag a stack in the crafting grid and drag it in the pattern we want to to make and automatically fill those spaces.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

Amaz
Member
 
Posts: 328
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: [0.4.12-dev] Inventory movement using shift

by Amaz » Wed Jun 17, 2015 16:36

Nathan.S wrote:Sounds good, now we just need drag support so we can drag a stack in the crafting grid and drag it in the pattern we want to to make and automatically fill those spaces.

I think that we already have it. You need to double rightclick with the itemstack and drag it with the right mouse button held down, although even then, it can be a bit temperamental...
 

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

Re: [0.4.12-dev] Inventory movement using shift

by Wuzzy » Wed Jun 17, 2015 18:51

This sounds like an incredible useful feature.

I have just one objection: Would it be possible to change the [Shift] key to something else, like [Ctrl] or whatever?
Please don't tell me you just used the Sneak key for that, that key is already very overused IMO.

I have another question: Will leftclick+shift, middleclick+shift and rightclick+shift behave differently (i.e. move all items, move 10 items, move 1 item)?
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [0.4.12-dev] Inventory movement using shift

by rubenwardy » Wed Jun 17, 2015 19:05

 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: [0.4.12-dev] Inventory movement using shift

by Nathan.S » Wed Jun 17, 2015 21:31

Amaz wrote:
Nathan.S wrote:Sounds good, now we just need drag support so we can drag a stack in the crafting grid and drag it in the pattern we want to to make and automatically fill those spaces.

I think that we already have it. You need to double rightclick with the itemstack and drag it with the right mouse button held down, although even then, it can be a bit temperamental...


I had no idea. Thanks a million.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

Marshall_maz
Member
 
Posts: 240
Joined: Mon Jul 14, 2014 17:13
In-game: Mazal

Re: [0.4.12-dev] Inventory movement using shift

by Marshall_maz » Tue Jun 23, 2015 07:56

I have tried this last night after updated to latest build. But shift-click does nothing. Doesn't shift items. Does this mean that the server is not updated ? IE must the update be done server side , client side or both server and client side ?
 

est31
Member
 
Posts: 172
Joined: Mon Dec 29, 2014 01:49

Re: [0.4.12-dev] Inventory movement using shift

by est31 » Tue Jun 23, 2015 11:08

Both clientside and modside (also gameside, minetest_game doesn't have listring functionality merged yet). You can already add it to chests in your mod. The only two mods/games I know of which have the functionality are the technic chests, and the minimal game.
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [0.4.12-dev] Inventory movement using shift

by 4aiman » Tue Jun 23, 2015 11:36

Neat!

Say, est31, is it possible (or is it planned) to use different listrings for different items? (i.e. is it possible to register a hook on_listring_move?)

What for:
- shift+click on a fuel - it goes to the fuel slot of a furnace;
- shift+click on an item that can be cooked - it goes to to the src slot of a furnace.

Maybe that can be done reading the groups of an item and move throughout the inventories having those in mind.
 

est31
Member
 
Posts: 172
Joined: Mon Dec 29, 2014 01:49

Re: [0.4.12-dev] Inventory movement using shift

by est31 » Tue Jun 23, 2015 11:59

Great idea! A hook might be not desireable due to lag considerations, but group based filtering should work -- if groups are transmitted to the client.
 

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

Re: [0.4.12-dev] Inventory movement using shift

by Wuzzy » Tue Jun 23, 2015 13:24

I am not sure if the extra hook is a good idea. Why not treating it like a ordinary inventory change? I don't see why this sound have any special treatment.
I thought the listrings were supposed to be mostly client-based helpers.
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [0.4.12-dev] Inventory movement using shift

by 4aiman » Tue Jun 23, 2015 17:29

Well, there are a lot of hooks in minetest and it's only natural that came to my mind with "top priority" ;)
Hooks aren't good in any case, 'cause there always will be modders who will abuse those hooks (Oh, me! Pick me! Right in front of you! C'mon! Pick me! I'm waiting! Just pick me already!).


Anyway, I know very *little* about internals of minetest.
I have nothing against any way to implement features mentioned above.
In fact I'm only *for* implementing those w/o any hooks.

The only thing I'm worried is the control over the filters.
I.e. the "src" slot may well be named "source" and it may well be that we won't be dealing with a common furnace but yet another sophisticated item process unit. So, there should be a way to connect a slot with a particular group of items and transfer only if a group is found in a listring definition.

Moreover, I've items that can fuel AND cooked item. I think that the higher the group rating - the more priority that group should have.
Example:
Say, there's a definition of a listring to place"fuel" to "fuel" slot and "raw_food" to "src" slot.
Say, fuel==2 and raw_food=1.
In this case shift+click should chose fuel group over the raw_food (because of the rating of the former group exceeds the rating of the latter group) regardless of the order of declaration or alpha-numeric order of the names of the groups.

Have no idea how to implement all of that, so I just leave the above ideas here ^____^
 

est31
Member
 
Posts: 172
Joined: Mon Dec 29, 2014 01:49

Re: [0.4.12-dev] Inventory movement using shift

by est31 » Tue Jun 23, 2015 17:42

There won't be hooks. I think comparing ratings is too complicated. I'll implement group matching though. I guess I'll just add conditionals to the listring -- add a new "listring" element, which gets chosen as destination only if the item in question has at least one group in common. It will never be chosen as "starting point", or if then only as a "generic" one. I'm not sure yet.
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: [0.4.12-dev] Inventory movement using shift

by orwell » Sun Jul 05, 2015 16:40

Don't know if this is important, but if you define a listring from the player inventory to the "craftpreview"-slot, the item is put there, and only after about 10sec the item is put back. doesn't work for simple drag-n-drop. (actually, it is not useful to define a listring to the craftpreview)

listring[current_player;main]
listring[current_player;craftpreview]

another thing: could it be possible to craft whole stacks by shift-clicking the stack?
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [0.4.12-dev] Inventory movement using shift

by 4aiman » Sun Jul 05, 2015 19:42

orwell wrote:another thing: could it be possible to craft whole stacks by shift-clicking the stack?

Right click, please :)

Edit:

LMB click: crafts only once.
LMB click + hold it down: crafts once, then continue to craft Terraria-like (the longer you hold the button - the more you'll craft).
RMB click: crafts up to stack_max items.

Then Shift+LMB click will be free to be used to send crafted items into your inventory :)
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: [0.4.12-dev] Inventory movement using shift

by orwell » Mon Jul 06, 2015 14:46

4aiman wrote:Right click, please :)

Does not work in stable 0.4.12 windows build from March. Currently can't try in latest dev. Did it change recently?
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [0.4.12-dev] Inventory movement using shift

by 4aiman » Tue Jul 07, 2015 06:13

orwell wrote:
4aiman wrote:Right click, please :)

Does not work in stable 0.4.12 windows build from March. Currently can't try in latest dev. Did it change recently?

Sorry..
Linux user here, so wasn't aware.


What's wrong with the RMB clicks?
I mean, we're using them for placing blocks, so...
The button does work but not with formspecs, did I get you right?

Is there an issue 'bout RMB clicks?

PS: I still think that RMB clicks are better for this purpose. If those are not working - it's high time to at least narrow down the cause ;)
 

est31
Member
 
Posts: 172
Joined: Mon Dec 29, 2014 01:49

Re: [0.4.12-dev] Inventory movement using shift

by est31 » Tue Jul 07, 2015 15:20

About whole stack single click crafting... I don't think it should be too easy, there should still be gameplay reasons to build autocrafters and such.
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: [0.4.12-dev] Inventory movement using shift

by 4aiman » Tue Jul 07, 2015 16:36

Honestly, I don't think that building an autocrafter is a good idea if all you have is 3-4 full stacks of items.
I can go clicking fiercely for 10 or so seconds and craft all that myself.
No autocrafter is worth building to win less than 3 seconds per stack.

But when it comes to a REAL mass production (like a wool factory) - autocrafters become essential.
This change won't affect the current system at all.

Moreover, there ain't no autocrafters in minetest_game.
If a mod adds one - it's a TODO for a mod to artificially make the game play harder.

That being said, maybe it would be nice to make shift-clicking depend on a formspec definition.
Merging this with listrings may be a good idea too. (At least it seems to be so ;)
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [0.4.13] Inventory movement using shift

by Don » Sat Sep 19, 2015 21:21

Just wondering if anything has been done for groups? I would like to be able to shift click dye and have it go to the dye slot or flora to the flora slot etc.
I would also like to be able to define a certain item to a slot. Eg. a slot that only accepts cobble.
If any of this has been done then can you point me to some info on how to do it?
If not then thanks anyway. I appreciate all your work.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

Amaz
Member
 
Posts: 328
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: [0.4.13] Inventory movement using shift

by Amaz » Sat Sep 19, 2015 21:35

Don wrote:Just wondering if anything has been done for groups? I would like to be able to shift click dye and have it go to the dye slot or flora to the flora slot etc.
I would also like to be able to define a certain item to a slot. Eg. a slot that only accepts cobble.
If any of this has been done then can you point me to some info on how to do it?
If not then thanks anyway. I appreciate all your work.


I don't know about your first question, but this might help for your second one: https://github.com/minetest/minetest_ga ... 1508-L1515
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [0.4.13] Inventory movement using shift

by Don » Sat Sep 19, 2015 21:43

Thanks. That helps.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [0.4.13] Inventory movement using shift

by Don » Sat Sep 19, 2015 23:06

I have a machine with an input and an output. There are buttons to create a new node.
I can shift click to the input from inventory. I can shift click from output to inventory but when I shift click input to put the stack back to inventory it goes to output.
How would I make it so input goes to player inventory?

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

      "list[current_name;input;10.5,6.5;1,1;]"..
      "listring[current_name;input]"..

      "list[current_name;output;10.5,8;1,1;]"..
      "listring[current_name;output]"..
      "listring[current_player;main]"..
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

est31
Member
 
Posts: 172
Joined: Mon Dec 29, 2014 01:49

Re: [0.4.13] Inventory movement using shift

by est31 » Mon Sep 21, 2015 04:57

How would I make it so input goes to player inventory?

If you want that "A goes to B", you should specify the first occurence of A directly before (any occurence of) B.

It seems you want a ring like:
output -> player inventory -> input -> player inventory

So that from output, it goes to the player's inventory, from the input it goes there too, and from the player's inventory it goes to the input.
In code that would look like
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
          "list[current_name;input;10.5,6.5;1,1;]"..
          "list[current_name;output;10.5,8;1,1;]"..

          "listring[current_name;output]"..
          "listring[current_player;main]"..
          "listring[current_name;input]"..
          "listring[current_player;main]"
 

est31
Member
 
Posts: 172
Joined: Mon Dec 29, 2014 01:49

Re: [0.4.13] Inventory movement using shift

by est31 » Mon Sep 21, 2015 05:00

About the groups: haven't yet come around to implement them. It's on my TODO list though, lets hope I don't forget it again :).
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [0.4.13] Inventory movement using shift

by Don » Mon Sep 21, 2015 05:33

est31 wrote:About the groups: haven't yet come around to implement them. It's on my TODO list though, lets hope I don't forget it again :).

Not trying to rush you. Just wondering. I am trying to learn how listring works.
Thanks for all you do est31
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
kaadmy
Member
 
Posts: 627
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: [0.4.13] Inventory movement using shift

by kaadmy » Tue Sep 22, 2015 00:14

est31 wrote:About the groups: haven't yet come around to implement them. It's on my TODO list though, lets hope I don't forget it again :).

Ah, yes. Being able to move from any arbitrary listring into another arbitrary listring would be very useful, like for furnaces.
Never paint white stripes on roads near Zebra crossings.
 

Next

Return to Minetest News

Who is online

Users browsing this forum: No registered users and 10 guests

cron