Page 1 of 1

Provide "currently hovered prototype" on a custom-input

Posted: Sat Feb 13, 2021 8:38 pm
by raiguard
The prototype explorer GUI works by pressing a hotkey when hovering over something in the GUI or on the map - entities, items, recipes, technologies, etc. Would it be possible to provide this same functionality to a custom-input? For example, hovering over a recipe in the crafting menu, and pressing a custom input, will provide an object in the event providing that info (e.g. e.hovered_object = {type = "recipe", name = "iron-plate"}).

This would allow me to support opening Recipe Book when someone uses its hotkey while hovering an object. The advantage of this is that they wouldn't have to open the GUI and search for the same thing they were already looking at.

Thank you!

Re: Provide "currently hovered prototype" on a custom-input

Posted: Sat Feb 13, 2021 9:47 pm
by blazespinnaker
Supported in map mode and other views as well would be great. Very surprised there is no API already for this.

Re: Provide "currently hovered prototype" on a custom-input

Posted: Thu Feb 18, 2021 8:02 pm
by Rseding91
Ok, I added include_selected_prototype as a new custom input property. When true and something is hovered that applies the following gets included in the event:

Code: Select all

selected_prototype = {base_type=, derived_type=, name=}