With https://factorio.com/blog/post/fff-318 promising fancy new tooltips for vanilla i'd like to take the chance and grab some attention to moddability of those. Currently there are two methods for tooltip modding:
Rich Text
hacky proof of concept
Disabled choose-elem-button
Both methods have problems:Rich Text while better than the plain text from pre-0.17 only offers very limited format control, but complete content control, and can be used on any type of gui element, not only buttons.
Disabled choose-elem-buttons automatically create standard tooltips and thus can not be extended with mod-specific information. They also can not be used on anything else like labels or sliders, switches etc.
So what?
So, i'd like to request more moddability for tooltips. There are two stages that this could be improved:
Stage1: Allow assigning a new "fancy multi-tooltip" of arbitrary composition to all LuaGuiElement types (or if difficult a limited subset). This means that it's up to the mod which tooltips should be shown, i.e. it should be possible to show a recipe alongside it's technology instead of it's products.
Stage2: Allow accessing tooltips as standard LuaGuiElements so they can be completely customized. As this needs to be performant for large numbers of tooltips on the same screen (i.e. Helmod/FactoryPlanner) i'm not sure how this would be done. Pre-creating all tooltips when a majority of them will never be shown seems inefficient. Using an event-based solution like "on_player_focused_element" to allow mods to dynamically create tooltips would incur multiplayer lag on tooltips which is also undesirable. And assigning a sandboxed function to each tooltip that dynamically creates it seems unrealistic, as does a custom "tooltip description language". So... given my lack of knowledge of engine internals and coding inexperience i regrettably don't really have a workable proposition for this :|.
Thank your for reading this far. And hopefully someone has useful feedback-feedback ;).