[mod] Cycle through inventory rows [inventory_cycler]

User avatar
taikedz
Member
 
Posts: 658
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

[mod] Cycle through inventory rows [inventory_cycler]

by taikedz » Sat Jan 12, 2019 12:55

Simple mod to cycle through inventory rows, to bring different rows into the "active" row without going into the inventory !

Whilst standing still, hold "Shift" and "E" *, and the your inventory rows will be switched up row by row, allowing you to access non-active rows without having to open the inventory!

Image

There is also a tool , Inventory Cycler, which allows you to cycle forwards (click) and back (right click/drop).


* (sprinting and sneaking whilst standing still makes no sense right? Should not interfere with any other mods this way. server can change setting to not require this)
Last edited by taikedz on Sat Jan 12, 2019 15:21, edited 1 time in total.
 

User avatar
DS-minetest
Member
 
Posts: 1036
Joined: Thu Jun 19, 2014 19:49
Location: in front of my pc (which is at home)
GitHub: DS-Minetest
In-game: DS

Re: [mod] Cycle through inventory rows [inventory_cycler]

by DS-minetest » Sat Jan 12, 2019 15:06

Nice idea!
However, in multiplayer this might be pretty laggy. And I don't like the key combination, eg. if you want to fly down fast (without always_fly_fast) you hold sneak and aux1.
I suggest that you can only move one row at time (hold it → it moves one row → release the keys → wait → hold again for second row swap).
Also a chatcommand would probably be useful if the server dowsn't react.
And it would be useful to be able to move into two directions.
I suggest some key combination like hold left, right and forward to swap the rows from down to up, backward instead of forward for the other direction.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
taikedz
Member
 
Posts: 658
Joined: Sun May 15, 2016 11:11
Location: Scotland, UK
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: [mod] Cycle through inventory rows [inventory_cycler]

by taikedz » Sat Jan 12, 2019 15:20

Yeah, the key combo is a bit of a kludge.... I could check for flying at the same time, but it also feels pretty bad.... still, you have to be moving to enable it, so would only kick in when flying straight down....

It's meant to help when running away from hostile mobs and your good sword is in another row.... maybe a heuristic of (running + LMB + moving) would work better ?

I'm going to give it a try on my own server Not So Simple Server - nobody has fly there so shouldn't be a problem for regular players.

There's also a tool for doing both backwards and forwards cycling, it's also a bit of a kludge - on_use makes it cycle forward, but on_place (cycle back) only works if pointing at a node... I got aruond that by defining on_drop but that means any time you try to chuck it from inventory it cycles your inventory instead....

Honestly, I'm open to extra input on what sane heuristics I could employ for it....
 

User avatar
texmex
Member
 
Posts: 1118
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
Napiophelios
Member
 
Posts: 966
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi
 

User avatar
TalkLounge
Member
 
Posts: 224
Joined: Sun Mar 26, 2017 12:42
Location: Germany
GitHub: TalkLounge
IRC: TalkLounge
In-game: TalkLounge

Re: [mod] Cycle through inventory rows [inventory_cycler]

by TalkLounge » Sun Jan 13, 2019 03:15

Neat idea!

Just shorten and changed a bit for my server
Code: Select all
local invtimer = 0
local invplayers = {}

local function invcycle(name)
   local inv = minetest.get_inventory({type = "player", name = name})
   local list = inv:get_list("main")
   for i = 1, 8 do
      list[i + 32] = list[i]
   end
   for i = 9, 40 do
      list[i - 8] = list[i]
   end
   for i = 33, 40 do
      list[i] = nil
   end
   inv:set_list("main", list)
end

minetest.register_globalstep(function(dtime)
      invtimer = invtimer + dtime
      if invtimer < 0.2 then
         return
      end
      invtimer = 0
      
      for _, player in ipairs(minetest.get_connected_players()) do
         local name = player:get_player_name()
         local keys = player:get_player_control()
         if not invplayers[name] and not keys.jump and not keys.right and not keys.left and not keys.LMB and not keys.RMB and not keys.sneak and not keys.down and not keys.up and keys.aux1 then
            invplayers[name] = true
            invcycle(name)
         elseif invplayers[name] and not keys.aux1 then
            invplayers[name] = nil
         end
      end
end)
Subgames Server: Sky World Subgames German Survival Server: Wildes Land 2 E-Mail: talklounge@yahoo.de
 


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 4 guests