Rendering API: selected entity option

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2428
Joined: Fri Nov 06, 2015 7:41 pm

Rendering API: selected entity option

Post by Deadlock989 »

All of the methods in the rendering API allow you to specify that the rendered sprites, rectangles etc. are only visible when alt-mode is on (only_in_alt_mode = true).

For most entities, all of the extra info shown for all entities on the screen in alt-mode (pipe connection info etc.) is also shown for each specific entity when they are "selected", i.e. the cursor is hovering over them. (There are exceptions, e.g. splitter priority indicators and recipe icons, but it seems to be true for a lot of things on a lot of entities.)

It is not possible to duplicate this behaviour in a single rendering API call. You could likely emulate the full range of behaviours by more elaborate means (e.g. using shared functions and the on_selected_entity_changed event) but that would be complex, is less performant, and would have to handle the avoidance of double-drawing things if the player selects an entity while already in alt-mode.

A useful alternative would be to have a new boolean option in the rendering methods, e.g. selected_entity_info = true. This would result in the rendering only being shown on "selection" / mouse-over and would only be applied if the rendering also sets a target entity. If combined with only_in_alt_mode = true, the rendering would be shown if either one of the conditions is true (selected or alt-mode on).
"If Stalin had a good writeup on programming, would linking that be dangerous?"

Post Reply

Return to “Modding interface requests”