add a right-click event for selection-tool in cursor

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
kyranzor
Filter Inserter
Filter Inserter
Posts: 499
Joined: Fri Oct 31, 2014 4:52 pm
Contact:

add a right-click event for selection-tool in cursor

Post by kyranzor »

Right now we have a left click event, and shift+left click (alt selection) event.

I request to add to the mod API a right click event, so that mods may put more interesting functionality into the mouse-based controls and selection logic.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14273
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: add a right-click event for selection-tool in cursor

Post by Rseding91 »

I'm not against the idea but it would need a name and have to show up in the keybindings list. However, in the base game it wouldn't *do* anything so there isn't a name to give it and it doesn't make sense to have in the keybindings list.
If you want to get ahold of me I'm almost always on Discord.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: add a right-click event for selection-tool in cursor

Post by eradicator »

Rseding91 wrote: Tue Oct 02, 2018 9:40 pm it would need a name
Some sort of freeform or diagonal select ?
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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14273
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: add a right-click event for selection-tool in cursor

Post by Rseding91 »

eradicator wrote: Wed Oct 03, 2018 12:17 pm
Rseding91 wrote: Tue Oct 02, 2018 9:40 pm it would need a name
Some sort of freeform or diagonal select ?
The game at its core does not support non-rectangular bounding boxes. So it would have no way to say "does this set of entities collide with X" when X isn't a rectangular bounding box.

To change that would mean change the entire collision system in the game - and that is not likely to happen.
If you want to get ahold of me I'm almost always on Discord.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: add a right-click event for selection-tool in cursor

Post by eradicator »

Hm. Maybe some kind of inverted selection? Or an exception for it to only show up when mods use it :x.
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.
SyncViews
Filter Inserter
Filter Inserter
Posts: 295
Joined: Thu Apr 21, 2016 3:17 pm
Contact:

Re: add a right-click event for selection-tool in cursor

Post by SyncViews »

Rseding91 wrote: Tue Oct 02, 2018 9:40 pm I'm not against the idea but it would need a name and have to show up in the keybindings list. However, in the base game it wouldn't *do* anything so there isn't a name to give it and it doesn't make sense to have in the keybindings list.
I just ran into this while thinking of nice ways to control some things without toggle buttons or multiple tools.
Maybe a mod could set a "flag" of sorts if the feature is wanted and the game only shows the control if so? Also it's not the sort of thing I ever considered rebinding, I am sure if I took a look many other games don't allow rebinding something like this even if they do general keyboard controls.


Or even let selection-tools have their own controls list that can be defined individually and potentially listed individually as well (so more like the "Select for cancel deconstruction" being the shift-click-drag option even if other things use it). I also ran into a potential case for single click, but that is easily solved by "not dragging". Maybe like:

Code: Select all

  {
    type = "selection-tool"
    name = "route-tool",
    icon = "__base__/graphics/icons/blueprint.png",
    icon_size = 32,
    flags = {"hidden"},
    subgroup = "other",
    order = "x",
    stack_size = 1,
    stackable = false,
    selection_modes =
    {
      {
        name="select",
        default_control="mouse-button-1",
        color = { r = 0, g = 1, b = 0 },
        mode= {"same-force", "any-entity"}
      },
      {
        name="add-to-selection",
        default_control="SHIFT + mouse-button-1",
        color = { r = 0, g = 1, b = 0 },
        mode= {"same-force", "any-entity"}
      },
      {
        name="destination",
        default_control="mouse-button-2",
        color = { r = 0, g = 0, b = 1 }
      },
      {
        name="add_waypoint",
        default_control="SHIFT + mouse-button-2",
        color = { r = 0, g = 0, b = 1 }
      }
    }
  },
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: add a right-click event for selection-tool in cursor

Post by darkfrei »

Lasso/ free form selection?
Post Reply

Return to “Modding interface requests”