Looking for a simple mod that creates a hot key that cycles through similar items

Looking for a mod? Have a review on a mod you'd like to share?
Post Reply
Trelawny
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed Sep 26, 2018 8:55 pm
Contact:

Looking for a simple mod that creates a hot key that cycles through similar items

Post by Trelawny »

I'm looking for a mod that creates a hot key and allows you to create groups of items. For example, if you have a small electric pole selected you can hit the key and it will cycle to the medium and large electric pole.

Does anyone know if this exists or can be made?

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Looking for a simple mod that creates a hot key that cycles through similar items

Post by steinio »

I don't think such a mod exists but it could be easy to code such.

I imagine a script which cycles through the current cursor stack item.type prototypes and if the next exists in inventory change cursor stack.
Image

Transport Belt Repair Man

View unread Posts

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Looking for a simple mod that creates a hot key that cycles through similar items

Post by eradicator »

Trelawny wrote:
Wed Sep 26, 2018 9:00 pm
allows you to create groups of items.
Allowing the user to create custom item groups requires some kind of user interaction, i.e. a GUI or console command, which makes the mod request quite a bit more complex than i.e. using a fixed list of items (i.e. splitter/belt/underground of the same color). Though without custom groups it would be mostly useless for modded items.

TL;DR: Is it possible? Sure. Is somebody gonna make it for you? Unsure.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Looking for a simple mod that creates a hot key that cycles through similar items

Post by steinio »

eradicator wrote:
Sat Sep 29, 2018 12:55 pm
Trelawny wrote:
Wed Sep 26, 2018 9:00 pm
allows you to create groups of items.
Allowing the user to create custom item groups requires some kind of user interaction, i.e. a GUI or console command, which makes the mod request quite a bit more complex than i.e. using a fixed list of items (i.e. splitter/belt/underground of the same color). Though without custom groups it would be mostly useless for modded items.

TL;DR: Is it possible? Sure. Is somebody gonna make it for you? Unsure.
I would dump the create groups idea because power poles have already a 'group' https://wiki.factorio.com/Prototype/ElectricPole

Maybe I have time to steel together some code snippets from other good mods :)
Image

Transport Belt Repair Man

View unread Posts

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Looking for a simple mod that creates a hot key that cycles through similar items

Post by eradicator »

steinio wrote:
Sat Sep 29, 2018 1:09 pm
I would dump the create groups idea because power poles have already a 'group' https://wiki.factorio.com/Prototype/ElectricPole
That link doesn't mention any groups. If you're talking about fast-replace groups they're not an adequate choice because you don't want to swap between different belt colors etcpp.

I made a demo/prototype mod:
er-cursor-stack-rotate_0.0.1.zip
(6.55 KiB) Downloaded 83 times

Default is ctrl+r/alt+r to rotate to the next/previous stack (can be changed in control options). Default groups are:

Code: Select all

  ['yellow-belt'] = {'transport-belt','underground-belt','splitter'},
  ['red-belt'] = {'fast-transport-belt','fast-underground-belt','fast-splitter'},
  ['blue-belt'] = {'express-transport-belt','express-underground-belt','express-splitter'},
  ['poles'] = {'small-electric-pole','medium-electric-pole','big-electric-pole','substation'},
  ['pipes'] = {'pipe','pipe-to-ground','pump','storage-tank'},
  ['trains'] = {'locomotive','cargo-wagon','fluid-wagon','artillery-wagon'},
  ['flooring'] = {'stone-brick','concrete','hazard-concrete','refined-concrete','refined-hazard-concrete','landfill'},
  ['solar'] = {'solar-panel','accumulator'},
  ['heat'] = {'heat-pipe','heat-exchanger'},
  ['signals'] = {'rail-signal','rail-chain-signal'},
  ['inserters'] = {'long-handed-inserter','fast-inserter','stack-inserter'},
There is a rudimentary command based editing system for groups:
See what groups exist:

Code: Select all

/stackrotate list
Remove a group:

Code: Select all

/stackrotate remove groupname
Add one or more groups (groupname can be chosen freely):

Code: Select all

/stackrotate add {groupname = {item1,item2,item3}}
Get the name of the item on the cursor (for creating groups you need to use the internal item name).

Code: Select all

/stackrotate tell
Reset to default groups:

Code: Select all

/stackrotate reset
Be aware that this is a prototype that hasn't seen much testing. It shouldn't break anything permanently, but you have been warned. Also the group editing commands have no sanity checking whatsoever, so you can mess up your groups quite easily if you want to, use the reset command if something happens.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Looking for a simple mod that creates a hot key that cycles through similar items

Post by darkfrei »

eradicator wrote:
Sat Sep 29, 2018 3:00 pm
steinio wrote:
Sat Sep 29, 2018 1:09 pm
I would dump the create groups idea because power poles have already a 'group' https://wiki.factorio.com/Prototype/ElectricPole
That link doesn't mention any groups. If you're talking about fast-replace groups they're not an adequate choice because you don't want to swap between different belt colors etcpp.
Pseudocode:

Code: Select all

On init, on change:
global = {}
For i, prototype in game.entity_prototypes do
 If not global[prototype.type] then
   global[prototype.type] ={}
 End
 table.insert(global[prototype.type], prototype.name)
End
And so you get all entities with same type.


Post Reply

Return to “Questions, reviews and ratings”