"Context" for selected_prototype in custom-inputs

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 777
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

"Context" for selected_prototype in custom-inputs

Post by raiguard »

I would like to request a new feature related to the "selected_prototype" field on custom-inputs. Currently, it will only return the thing "contained" in whatever you use the custom-input on. However, it does not tell you what the user actually had selected.

For example, there is no way for me to tell that they used the custom-input on a gun slot:
Screenshot from 2021-04-05 11-13-55.png
Screenshot from 2021-04-05 11-13-55.png (35.21 KiB) Viewed 1239 times
I wish to be able to move the information contained in the tooltips into a scrollable GUI, and remove the tooltips. This would allow the user to easily click on each thing to view more information, and search the list if it is too long. If I can detect that they used the hotkey on a gun slot, I could retrieve that information from my mod's database and present it in a nice GUI.

Ideally, this property would be available even if there is no prototype "contained" in the thing. So if they use it on an empty gun slot, I would still want to know that they used it on a gun slot. To this end, a new field on the custom-input "selected_context" might be appropriate.
Don't forget, you're here forever.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16586
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: "Context" for selected_prototype in custom-inputs

Post by Rseding91 »

Unfortunately that information simply isn't known and I can't see any viable way to get it with how the logic works now.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Shemp
Inserter
Inserter
Posts: 20
Joined: Mon Jan 19, 2026 6:51 pm
Contact:

Re: "Context" for selected_prototype in custom-inputs

Post by Shemp »

Rseding91 wrote: Thu Apr 08, 2021 11:48 pm Unfortunately that information simply isn't known and I can't see any viable way to get it with how the logic works now.
Is this still true in Factorio 2.0? I was considering making a suggestion for SelectedSlotData which would accompany SelectedPrototypeData in CustomInput events, to let the event know which slot in a GUI (if any) was being hovered during an event.

SelectedSlotData would have at least two fields:
  • inventory_type: is a value from defines.inventory
  • index: would be the index of the slot from that inventory.
Ideally it would also work for fluids inside assembling-machines, with a way to get the fluid_box index.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16586
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: "Context" for selected_prototype in custom-inputs

Post by Rseding91 »

Nothing about this has changed since its inception.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Modding interface requests”