alt_reverse_selection for Selection tools

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 702
Joined: Sun May 07, 2017 10:16 am
Contact:

alt_reverse_selection for Selection tools

Post by ickputzdirwech »

I would like to create a selection tool that does the following things:
  • selection = Do something to all selected entities.
  • reverse_selection = Do the opposite to all selected entities.
  • alt_selection = Do something to all not selected entities.
  • alt_reverse_selection = Do the opposite to all not selected entities.
Unfortunately alt_reverse_selection does not exist yet. Any chance you might add this?

Another potentially usecase could be the upgrade planner:
  • selection = Upgrade
  • reverse_selection = Downgrade
  • alt_selection = Cancel upgrades (right now this cancels all up- and downgrades)
  • alt_reverse_selection = Cancel downgrades
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

Qon
Smart Inserter
Smart Inserter
Posts: 1743
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: alt_reverse_selection for Selection tools

Post by Qon »

ickputzdirwech wrote:
Sun May 22, 2022 12:18 pm
I would like to create a selection tool that does the following things:
  • alt_selection = Do something to all not selected entities.
  • alt_reverse_selection = Do the opposite to all not selected entities.
You want a tool to do something to every entity on every surface, except the things inside the selection area? So basically selecting things outside the rectangle? Sounds like it might easily lead to disaster and major performance issues, potentially game crashing, for you to avoid zooming out of the map and make a few bigger selections. When would this ever be useful? And why would you need api support for something this rare? You could make an alt selection tool yourself with the current api anyways already (just calculate what entities exist outside the area or set of entities given by the current api).

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 1196
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: alt_reverse_selection for Selection tools

Post by FuryoftheStars »

Qon wrote:
Tue May 24, 2022 1:08 pm
ickputzdirwech wrote:
Sun May 22, 2022 12:18 pm
I would like to create a selection tool that does the following things:
  • alt_selection = Do something to all not selected entities.
  • alt_reverse_selection = Do the opposite to all not selected entities.
You want a tool to do something to every entity on every surface, except the things inside the selection area? So basically selecting things outside the rectangle? Sounds like it might easily lead to disaster and major performance issues, potentially game crashing, for you to avoid zooming out of the map and make a few bigger selections. When would this ever be useful? And why would you need api support for something this rare? You could make an alt selection tool yourself with the current api anyways already (just calculate what entities exist outside the area or set of entities given by the current api).
I think what might be meant by "all not selected entities" is entities within the selection area that were not actually selected due to the filtering criteria.

User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 702
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: alt_reverse_selection for Selection tools

Post by ickputzdirwech »

I won't deny that my specific use case might be a bit obscure. I think it's important to clarify that adding alt_reverse_selection would allow the following schema:
  1. do something
  2. do the opposite
  3. reverse 1
  4. reverse 2
That the fourth option doesn't exists, feels like a whole in the matrix to me. Adding a second tool would mean that the player would have to actively pick the right one and would have to switch between them (very inconvenient):

For those of you who are interested in the specific problem I want to solve:

In the Shortcuts for 1.1 mod I have an artillery toggle selection tool. Right now it disables all selected enabled artillery turrets AND enables all selected disabled artillery turrets. I would like to change it from a toggle to an enable/disable behaviour. Then it would either enable all selected disabled artillery turrets (normal selection) OR disable all selected enabled artillery turrets (reverse selection). At the same time I would like to add an "all-except-selected" mode. Then it could also enable all non-selected disabled artillery turrets (alt_selection) OR disable all non-selected enabled artillery turrets (alt_reverse_selection).

Right now I can only implement one of the two ideas at the same time.

And if you are worried about performance. Doing a find_entities_filtered isn't that bad if triggered only once in a while with a very limit amount of entities to look for.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write

Qon
Smart Inserter
Smart Inserter
Posts: 1743
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: alt_reverse_selection for Selection tools

Post by Qon »

ickputzdirwech wrote:
Tue May 24, 2022 5:15 pm

That the fourth option doesn't exists, feels like a whole in the matrix to me.
Seems reasonable. I agree with this.

What I'm against is for selection tools by default to have a modifier to select the things outside the region. And I don't think you want it for your tool either. It's going to confuse users and be clunkier than the alternative.
ickputzdirwech wrote:
Tue May 24, 2022 5:15 pm

For those of you who are interested in the specific problem I want to solve:

In the Shortcuts for 1.1 mod I have an artillery toggle selection tool. Right now it disables all selected enabled artillery turrets AND enables all selected disabled artillery turrets. I would like to change it from a toggle to an enable/disable behaviour. Then it would either enable all selected disabled artillery turrets (normal selection) OR disable all selected enabled artillery turrets (reverse selection). At the same time I would like to add an "all-except-selected" mode. Then it could also enable all non-selected disabled artillery turrets (alt_selection) OR disable all non-selected enabled artillery turrets (alt_reverse_selection).
A second tool that selects outside is also bad. And I agree that it should be one tool. But instead of doing outside region selections, have gui buttons on top or left area appear only while holding the tool that disable and enable all turrets. Then you can use the tool to enable (or disable) the selected turrets. This way making multiple enabled regions is also consistent. Instead of doing one weird outside selection that disables things outside the selection (and not leaving things inside in a known state) and then doing normal selection-enable actions for additional regions, you disable all and then mark the regions you want to enable.

Post Reply

Return to “Modding interface requests”