Expose entities' status diode_color and label even for non-custom states

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
petrathekat
Inserter
Inserter
Posts: 26
Joined: Fri Apr 19, 2024 7:12 pm
Contact:

Expose entities' status diode_color and label even for non-custom states

Post by petrathekat »

Hello,

Right now the only interface modders have to get information about an entity's status is LuaEntity::status, which is just an enum. This means that if you want to render your own diode+label combination, say in a custom GUI for an entity, you have to write a lot of code to figure out the localisation of that status and what sprite to draw.

The code for getting the localisation key has already been posted on the forums: viewtopic.php?p=538298. However it will still be a lot of manual code to associate each status with its correct color sprite, and it's a bunch of unnecessary and error-prone mapping for a value the game already knows.

I suggest adding LuaEntity::status_diode of type defines.entity_status_diode and LuaEntity::status_label of type LocalisedString. But of course you are free to implement whatever interface you wish :)
Post Reply

Return to “Modding interface requests”